diff --git a/libvirt/manifests/init.pp b/libvirt/manifests/init.pp index 348efda..ed32a6d 100644 --- a/libvirt/manifests/init.pp +++ b/libvirt/manifests/init.pp @@ -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. # # === Global variables @@ -129,4 +139,34 @@ class libvirt::kvm inherits libvirt::client { 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", + } + }