puppet/libvirt/manifests/init.pp
2012-02-28 11:30:11 +02:00

57 lines
1.2 KiB
Puppet

# Install libvirt software.
#
class libvirt::client {
include user::system
realize(User["qemu"], Group["qemu"])
case $operatingsystem {
centos,fedora: {
package { [ "libvirt", "virt-manager", "virt-viewer", ]:
ensure => installed,
require => [ User["qemu"], Group["qemu"] ],
}
}
default: {
fail("Not supported on ${operatingsystem}.")
}
}
}
# Install and configure KVM and libvirtd.
#
# === Global variables
#
# $libvirt_admingroup:
# Group which has access to system libvirtd.
#
class libvirt::kvm inherits libvirt::client {
package { "qemu-kvm":
ensure => installed,
before => Service["libvirtd"],
require => [ User["qemu"], Group["qemu"] ],
}
if !$libvirt_admingroup {
$libvirt_admingroup = "root"
}
file { "/etc/libvirt/libvirtd.conf":
ensure => present,
mode => 0644,
owner => "root",
group => "root",
content => template("libvirt/libvirtd.conf.erb"),
require => Package["libvirt"],
notify => Service["libvirtd"],
}
service { "libvirtd":
ensure => running,
enable => true,
}
}