From 071020fef55dc521201ad78abd8599e13e573c5f Mon Sep 17 00:00:00 2001 From: Adam Henry Lewenberg <adamhl@stanford.edu> Date: Wed, 20 Dec 2017 13:04:20 -0800 Subject: [PATCH] allow disabling of some difficult facts --- manifests/os.pp | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/manifests/os.pp b/manifests/os.pp index ad0d79a..87be6ec 100644 --- a/manifests/os.pp +++ b/manifests/os.pp @@ -1,7 +1,11 @@ # General configuration of the basic operating system. Nearly everything # here is specific to the version of Linux we're running and is handled by # the appropriate separate class. -class base::os { + +class base::os( + $enable_dell_warranty_facts = false, + $enable_iptables_facts = false, +){ case $::operatingsystem { 'Debian': { include base::os::debian } @@ -17,24 +21,29 @@ class base::os { template => 'base/os/motd.erb', } - # Get warranty expiration facts for Dell hardware. - if ($::manufacturer =~ /Dell/) { - file { - '/etc/cron.d/dell-warranty-facts': - source => 'puppet:///modules/base/os/etc/cron.d/dell-warranty-facts'; - '/var/lib/puppet/sufact/su_dell_warranty_days': - ensure => present; - '/var/lib/puppet/sufact/su_dell_warranty_end': - ensure => present; + # Get warranty expiration facts for Dell hardware, but only if + # the $enable_dell_warranty_facts parameter is true. + if ($enable_dell_warranty_facts) { + if ($::manufacturer =~ /Dell/) { + file { + '/etc/cron.d/dell-warranty-facts': + source => 'puppet:///modules/base/os/etc/cron.d/dell-warranty-facts'; + '/var/lib/puppet/sufact/su_dell_warranty_days': + ensure => present; + '/var/lib/puppet/sufact/su_dell_warranty_end': + ensure => present; + } + include packages::curl } - include packages::curl } # Generate an iptables fact for the firewall team to query. - file { '/var/lib/puppet/sufact/su_iptables': - ensure => $::osfamily ? { - 'RedHat' => '/etc/sysconfig/iptables', - default => '/etc/iptables/general', + if ($enable_iptables_facts) { + file { '/var/lib/puppet/sufact/su_iptables': + ensure => $::osfamily ? { + 'RedHat' => '/etc/sysconfig/iptables', + default => '/etc/iptables/general', + } } } -- GitLab