2015-01-23 18:12:10 +01:00
|
|
|
# == Class: proxmox::vm::openvz
|
|
|
|
#
|
|
|
|
# Manage OpenVZ virtual machines (CT aka Containers)
|
|
|
|
#
|
|
|
|
class proxmox::vm::openvz {
|
|
|
|
|
|
|
|
File {
|
|
|
|
owner => root,
|
|
|
|
group => root,
|
2015-01-26 12:11:34 +01:00
|
|
|
mode => 0644,
|
2015-01-23 18:12:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Test if a virtual interface is available
|
2015-03-18 10:50:03 +01:00
|
|
|
## has_interface_with needs double quoted string for the argument !
|
2015-01-26 12:11:34 +01:00
|
|
|
if has_interface_with("eth0") {
|
2015-01-23 18:12:10 +01:00
|
|
|
|
2015-03-18 10:50:03 +01:00
|
|
|
## has_interface_with needs double quoted string for the argument !
|
2015-01-26 16:04:53 +01:00
|
|
|
if has_interface_with("venet0_0") { # Virtual network available too?
|
2015-01-23 18:12:10 +01:00
|
|
|
|
|
|
|
# Need to configure eth0 in an interfaces.tail file because
|
|
|
|
# the main interfaces file is auto-generated by PVE (for venet config)
|
2015-03-18 10:50:03 +01:00
|
|
|
file { $proxmox::vm::vm_interfaces_tail_path:
|
2015-01-23 18:12:10 +01:00
|
|
|
ensure => present,
|
2015-03-18 10:50:03 +01:00
|
|
|
content => template($proxmox::vm::vm_interfaces_tail_content),
|
2015-01-23 18:12:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else { # Only virtual interface is available
|
|
|
|
|
|
|
|
# If eth0 is the only interface, push it's configuration in the standard interfaces file
|
2015-03-18 10:50:03 +01:00
|
|
|
file { $proxmox::vm::vm_interfaces_path:
|
2015-01-23 18:12:10 +01:00
|
|
|
ensure => present,
|
2015-03-18 10:50:03 +01:00
|
|
|
content => template($proxmox::vm::vm_interfaces_content),
|
2015-01-23 18:12:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
} # fi
|
|
|
|
} # fi; don't need any additionnal network configuration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} # Private class: proxmox::vm::openvz
|