72 lines
1.8 KiB
Puppet
72 lines
1.8 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 {
|
|
|
|
case operatingsystem {
|
|
centos,fedora: {
|
|
case $operatingsystemrelease {
|
|
'/5\.[0-9]+/': {
|
|
package { "kvm":
|
|
ensure => installed,
|
|
before => Service["libvirtd"],
|
|
require => [ User["qemu"], Group["qemu"] ],
|
|
}
|
|
}
|
|
default: {
|
|
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,
|
|
}
|
|
|
|
}
|