libvirt: Added libvirt_host for libvirt guests
This commit is contained in:
parent
9fc6ec8706
commit
c6ab89af53
1 changed files with 40 additions and 0 deletions
|
@ -28,6 +28,16 @@ class libvirt::client {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Configure libvirt guest.
|
||||||
|
#
|
||||||
|
class libvirt::guest {
|
||||||
|
|
||||||
|
Libvirt::Facts <<| title == $::homename |>>
|
||||||
|
Libvirt::Facts <<| title == $::hostname |>>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Install and configure KVM and libvirtd.
|
# Install and configure KVM and libvirtd.
|
||||||
#
|
#
|
||||||
# === Global variables
|
# === Global variables
|
||||||
|
@ -129,4 +139,34 @@ class libvirt::kvm inherits libvirt::client {
|
||||||
subscribe => $iptables,
|
subscribe => $iptables,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $::libvirt_activedomains {
|
||||||
|
$domains = split($::libvirt_activedomains, ',')
|
||||||
|
@@libvirt::facts { $domains:
|
||||||
|
host => $::homename,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Set libvirt external facts.
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# $host:
|
||||||
|
# libvirt host name.
|
||||||
|
#
|
||||||
|
define libvirt::facts($host) {
|
||||||
|
|
||||||
|
file { "/etc/facter/facts.d/libvirt.txt":
|
||||||
|
ensure => present,
|
||||||
|
mode => "0644",
|
||||||
|
owner => "root",
|
||||||
|
group => $::operatingsystem ? {
|
||||||
|
"openbsd" => "wheel",
|
||||||
|
default => "root",
|
||||||
|
},
|
||||||
|
content => "libvirt_host=${host}\n",
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue