Puppet Module for Virtualization Management
Puppet Module to manage virtual machines. Provides a the type: virt.
On agent
pluginsync=true in puppet.confManage virtual environments. [Xen] 1, [KVM] 2, [OpenVZ] 3, and [LXC] 4 hypervisors are supported, which of the first three uses [libvirt] 5 as provider. This module is the result of my work at GSoC 2010. I thank [Reliant Security] 6 for funding the OpenVZ provider development.
Autorequires: If Puppet is managing Xen or KVM guests, the virt resource will autorequire libvirt library.
OpenVZ Examples:
virt { guest-openvz1:
ensure => 'running',
id => 101,
os_template => 'ubuntu-10.10',
virt_type => 'openvz',
autoboot => 'false'
}Note that some values can be specified as an array of values:
virt { guest-openvz2:
ensure => 'installed',
memory => 512,
os_template => 'ubuntu-10.10-x86_64',
virt_type => 'openvz',
autoboot => true,
interfaces => ["eth0", "eth1"]
}KVM examples:
virt { guest-kvm1:
memory => 512,
virt_path => '/home/user/disk0.qcow2',
ensure => installed,
virt_type => 'kvm'
}
# clone from kvm1
virt { guest-kvm2:
clone => 'guest-kvm1',
ensure => running,
virt_type => 'kvm'
}lXC Examples:
virt { guest-lxc1:
ensure => running,
os_template => 'ubuntu',
provider => 'lxc'
}
# clone from lxc1
virt { guest-lxc2:
ensure => running,
clone => 'guest-lxc1',
snapshot => true,
provider => 'lxc',
require => Virt['lxc1']
}| Features \ Provider | libvirt | openvz | lxc |
|---|---|---|---|
| disabled | X | ||
| cpu_fair | X | ||
| disk_quota | X | ||
| pxe | X | ||
| iptables | X | ||
| graphics | X | ||
| clocksync | X | ||
| boot_params | X | ||
| manages_lvm | X | ||
| manages_resources | X | ||
| manages_capabilities | X | ||
| manages_features | X | ||
| manages_devices | X | ||
| manages_users | X | ||
| manages_behaviour | X | ||
| initial_config | X | X | |
| storage_path | X | ||
| cloneable | X | X | |
| backingstore | X |
A description of the virutal machine. Generally is what services it provides.
The guest's hostname. It not specified, name will be used as VE's hostname.
OpenVZ CT ID. It must be an integer greater then 100. CT ID .conf-sample` are put into the container configuration file. If this container configuration file already exists, it will be removed.
LXC:
Specify the configuration file to configure the virtualization and isolation functionalities for the container
Requires features initial_config.
User name and password. It is generally a good idea to keep to the degenerate 8 characters, beginning with a letter.
Sets password for the given user in the guest, creating the user if it does not exists. In case guest is not running, it is automatically mounted, then all the appropriate file changes are applied, then it is unmounted.
Requires features manages_users.
For OpenVZ guests, must use the format: "user:password"
IP address(es) of the guest. Multiple IP addresses should be specified as an array.
Connect the guest network to the host using the specified network as a bridge. The value can take one of 2 formats:
disabled: The guest will have no network.[ "ethX", ... ] | "ethX": The guest can receive one or an array with interface's name from host to connect to the guest interfaces.ifname[,mac,host_ifname,host_mac,[bridge]]: For OpenVZ hypervisor, the network interface must be specified using the format above, where:XX:XX:XX:XX:XX:XX.Bridge is an optional parameter which can be used in custom network start scripts to automatically add the interface to a bridge. All parameters except ifname are optional and are automatically generated if not specified.
If the specified interfaces does not exist, it will be ignored and raises a warning.
Fixed MAC address for the guest; If this parameter is omitted, or the value "RANDOM" is specified a suitable address will be randomly generated.
For Xen virtual machines it is required that the first 3 pairs in the MAC address be the sequence '00:16:3e', while for QEMU or KVM virtual machines it must be '54:52:00'. For OpenVZ virtual machine, the interface must exists previously.
Moves network device from the host system to a specified OpenVZ guest. Multiple network cards should be specified as an array.
Requires features manages_devices.
DNS name server(s). Multiple name servers should be specified as an array.
DNS search domain name(s).
Requires features iptables.
The domain's installation architecture. Not Changeable. If not specified for OpenVZ guests, it will assume the same archtecture from host machine.
The maximum amount of memory allocation for the guest domain.
Number of virtual CPUs active in the guest domain.
CPU weight for a guest. Argument is positive non-zero number, passed to and used in the kernel fair scheduler.
The larger the number is, the more CPU time this guest gets. Maximum value is 500000, minimal is 8. Number is relative to weights of all the other running guests. If cpuunits are not specified, default value of 1000 is used.
Requires features cpu_fair.
Limit of CPU usage for the guest, in per cent. Note if the computer has 2 CPUs, it has total of 200% CPU time. Default CPU limit is 0 (no CPU limit).
Requires features cpu_fair.
Assigns I/O priority to guest. Priority range is 0-7. The greater priority is, the more time for I/O activity guest has. By default each guest has priority of 4.
Requires features cpu_fair.
Setup a virtual console in the guest to be imported. If no graphics option is specified, will default to enable. Available values:
enable: Setup a virtual console in the guest and export it as a VNC server in the host. The VNC server will run on the first free port number at 5900 or above.vnc:VNCPORT: Request a permanent, statically assigned port number for the guest VNC console. Use of this option is discouraged as other guests may automatically choose to run on this port causing a clash.disable: No graphical console will be allocated for the guest.
Requires features graphics.The guest clock synchronization can assume three possible values, allowing fine grained control over how the guest clock is synchronized to the host. NB, not all hypervisors support all modes. Available values:
utc: The guest clock will always be synchronized to UTC when bootedlocaltime: The guest clock will be synchronized to the host's configured timezone when booted, if any.timezone: The guest clock will be synchronized to the requested timezone using the timezone attribute.variable: The guest clock will have an arbitrary offset applied relative to UTC. The delta relative to UTC is specified in seconds, using the adjustment attribute. The guest is free to adjust the RTC over time an expect that it will be honoured at next reboot. This is in contrast to 'utc' mode, where the RTC adjustments are lost at each reboot.
NB, at time of writing, only QEMU supports the variable clock mode, or custom timezones.Requires features clocksync.
The URL from where download OpenVZ precreated templates. Default value: http://download.openvz.org/template/precreated/
Installation source for guest virtual machine kernel+initrd pair. The url can take one of the following forms:
DIRECTORY: Path to a local directory containing an installable distribution imagenfs:host:/path or nfs://host/path: An NFS server location containing an installable distribution imagehttp://host/path: An HTTP server location containing an installable distribution imageftp://host/path: An FTP server location containing an installable distribution imageRequires features boot_params.
Additional kernel command line arguments to pass to the installer when performing a guest install from declared location.
Requires features boot_params.
The kickstart file location. Requires features boot_params.
Path to disk image file. This field is mandatory for Xen and KVM guests. NB: Initially only import existing disk is available for this provider. Image files must end with *.img, *.qcow or *.qcow2
Whether specified to set the path to directory in which all the files and directories specific to this very guest are stored (default VE_PRIVATE is specified in vz.conf file). Argument can contain string $VEID, which will be substituted with the numeric CT ID.
Size (in GB) to use if creating new guest storage. Not changeable.
Sets soft overusage time limit for disk quota (also known as grace period).
Requires features disk_quota.
Sets maximum number of user/group IDs in a guest for which disk quota inside the guest will be accounted. If this value is set to 0, user and group quotas inside the guest will not be accounted.
Note that if you h
No open issues yet, or sync has not completed.