install virt-what and use facter's default virtual facts
authorPeter Palfrader <peter@palfrader.org>
Thu, 17 Aug 2017 09:31:43 +0000 (11:31 +0200)
committerPeter Palfrader <peter@palfrader.org>
Thu, 17 Aug 2017 09:33:17 +0000 (11:33 +0200)
Discussion in #d-a suggests that on jessie facter needs the virt-what
package installed for the virtual and is_virtual facts to work.
Install it on jessie (and purge on stretch and later), and revert to
using the facter's default facts about virtualization.

Also remove our own systemd based virt fact.

modules/debian_org/lib/facter/virt.rb [deleted file]
modules/debian_org/manifests/init.pp
modules/grub/manifests/init.pp
modules/time/manifests/init.pp

diff --git a/modules/debian_org/lib/facter/virt.rb b/modules/debian_org/lib/facter/virt.rb
deleted file mode 100644 (file)
index b5b318b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-Facter.add("virt") do
-       setcode do
-               begin
-                       `systemd-detect-virt`.chomp()
-               rescue Errno::ENOENT
-                       nil
-               end
-       end
-end
-p
index 416d3d0..eb0c425 100644 (file)
@@ -12,6 +12,13 @@ class debian_org {
                $servicefiles = 'absent'
        }
 
+       # the virtual facter needs virt-what on jessie to work
+       if versioncmp($::lsbmajdistrelease, '9') < 0 {
+               package { 'virt-what': ensure => installed }
+       } else {
+               package { 'virt-what': ensure => purged }
+       }
+
        $debianadmin = [
                'debian-archive-debian-samhain-reports@master.debian.org',
                'debian-admin@ftbfs.de',
index 1f6e7e6..1ef9ec7 100644 (file)
@@ -1,5 +1,5 @@
 class grub {
-       if ($::kernel == 'Linux' and $::virt == 'kvm') {
+       if ($::kernel == 'Linux' and $::is_virtual and $::virtual == 'kvm') {
                file { '/etc/default/grub':
                        # restore to default
                        source => 'puppet:///modules/grub/etc-default-grub',
index 808ef28..9f1ec60 100644 (file)
@@ -3,9 +3,8 @@ class time {
        $localtimeservers = hiera('local-timeservers', [])
        $physicalHost = $site::allnodeinfo[$fqdn]['physicalHost']
 
-       # if ($::kernel == 'Linux' and $::is_virtual and $::virtual == 'kvm'
        #if ($systemd and $physicalHost and size($localtimeservers) > 0) {
-       if ($systemd and size($localtimeservers) > 0 and $::virt == 'kvm') {
+       if ($systemd and size($localtimeservers) > 0 and $::is_virtual and $::virtual == 'kvm') {
                include ntp::purge
                include systemdtimesyncd
        } else {