百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

puppet-virt

> 编程语言
开源

用于虚拟化管理的 Puppet 模块

163 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

用于虚拟化管理的 Puppet 模块

Puppet Virtualization Management Module

Puppet Module to manage virtual machines. Provides a the type: virt.

Requirements

On agent

  • ruby-libvirt 0.4.0 (gem)
  • virtinst 0.600 (package)
  • pluginsync=true in puppet.conf

virt

Manage 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:

puppet
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:

puppet
virt { guest-openvz2:
  ensure      => 'installed',
  memory      => 512,
  os_template => 'ubuntu-10.10-x86_64',
  virt_type   => 'openvz',
  autoboot    => true,
  interfaces  => ["eth0", "eth1"]
}

KVM examples:

puppet
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:

puppet
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

  • disabled: The provider can disable guest start.
  • cpu_fair: The provider can manage CPU usage by guest.
  • disk_quota: The provider can set disk usage quota by the guest.
  • pxe: The provider supports guests creation using pxe.
  • iptables: The provider can loads iptables modules on the guest.
  • graphics: The provider can setup a virtual console in the guest for VNC.
  • clocksync: The provider can specify the guest's clock syncronization method.
  • boot_params: The provider support parameters for the guest boot.
  • manages_lvm: The provider manages LVM configuration.
  • manages_resources: The provider manage a set of limits and guarantees controlled per guest.
  • manages_capabilities: The provider manage a set of capabilities for a guest.
  • manages_features: The provider can enable or disable a specific guest feature.
  • manages_devices: The provider can give the guest an access to a device.
  • manages_users: The provider manage guest's users and passwords.
  • manages_behaviour: The provider manage the quest's behaviour for reboot, crash and shutdown.
  • initial_config: The provider can receive a config file with default values for VE or lxc creation.
  • storage_path: The provider can set the path to storage and mount VE files.
  • cloneable: The provider can create clones of other instances
  • backingstore: The provider can use a backingstore such as lvm or btrfs
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

Parameters

desc

A description of the virutal machine. Generally is what services it provides.

name
  • namevar The guest's name.
hostname

The guest's hostname. It not specified, name will be used as VE's hostname.

id

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

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"

ipaddr

IP address(es) of the guest. Multiple IP addresses should be specified as an array.

interfaces

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:
  • 'ifname' is the ethernet device name in the guest;
  • 'mac' is its MAC address;
  • 'host_ifname' is the ethernet device name on the host;
  • 'host_mac' is its MAC address. MAC addresses should be in the format like 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.

macaddrs

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.

network_cards

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.

nameserver

DNS name server(s). Multiple name servers should be specified as an array.

searchdomain

DNS search domain name(s).

iptables

Requires features iptables.

arch

The domain's installation architecture. Not Changeable. If not specified for OpenVZ guests, it will assume the same archtecture from host machine.

memory

The maximum amount of memory allocation for the guest domain.

cpus

Number of virtual CPUs active in the guest domain.

cpuunits

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.

cpulimit

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.

ioprio

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.

graphics

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.
clocksync

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 booted
  • localtime: 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.

tmpl_repo

The URL from where download OpenVZ precreated templates. Default value: http://download.openvz.org/template/precreated/

boot_location

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 image
  • nfs:host:/path or nfs://host/path: An NFS server location containing an installable distribution image
  • http://host/path: An HTTP server location containing an installable distribution image
  • ftp://host/path: An FTP server location containing an installable distribution image

Requires features boot_params.

boot_options

Additional kernel command line arguments to pass to the installer when performing a guest install from declared location. Requires features boot_params.

kickstart

The kickstart file location. Requires features boot_params.

virt_path

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

private

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.

disk_size

Size (in GB) to use if creating new guest storage. Not changeable.

quotatime

Sets soft overusage time limit for disk quota (also known as grace period). Requires features disk_quota.

quotaugidlimit

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

Issues· 11 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言