diff options
-rw-r--r-- | README | 17 | ||||
-rw-r--r-- | manifests/puppetmaster.pp | 10 | ||||
-rw-r--r-- | manifests/puppetmaster/cleanup_reports.pp | 19 | ||||
-rw-r--r-- | manifests/puppetmaster/cleanup_reports/disable.pp | 6 |
4 files changed, 29 insertions, 23 deletions
@@ -62,11 +62,20 @@ Reports cleanup: --------------- By default we clean up reports older than 30 days. If you want to change -that, you can set $puppetmaster_cleanup_reports to one of the following -values: +that, you can subclass puppet::puppetmaster and overwrite the included class and +include that one instead: + +class mypuppetmaster inherits puppet::master { + Class['puppet::puppetmaster::cleanup_reports']{ + cleanup_older_than => 'absent' + } +} + +Where 'absent' means not to cleanup records and X any other amount of days. + +You can also adjust the locations of the reports to your needs, by setting the param +`reports_dir` to something different. -* 'X', where X is the amount of days you want to keep reports for -* false, to disable reports cleanup Check last run: --------------- diff --git a/manifests/puppetmaster.pp b/manifests/puppetmaster.pp index 3e8711c..55e1dab 100644 --- a/manifests/puppetmaster.pp +++ b/manifests/puppetmaster.pp @@ -29,14 +29,8 @@ class puppet::puppetmaster inherits puppet { include puppet::puppetmaster::cluster } - case $puppetmaster_cleanup_reports { - '': { $puppetmaster_cleanup_reports = '30' } - } - - if $puppetmaster_cleanup_reports { - include puppet::puppetmaster::cleanup_reports - } else { - include puppet::puppetmaster::cleanup_reports::disable + class{'puppet::puppetmaster::cleanup_reports': + cleanup_older_than => '30', } if $use_shorewall { diff --git a/manifests/puppetmaster/cleanup_reports.pp b/manifests/puppetmaster/cleanup_reports.pp index 664bd81..d25e8ac 100644 --- a/manifests/puppetmaster/cleanup_reports.pp +++ b/manifests/puppetmaster/cleanup_reports.pp @@ -1,8 +1,17 @@ -class puppet::puppetmaster::cleanup_reports { +class puppet::puppetmaster::cleanup_reports( + $cleanup_older_than = 'absent', + $reports_dir = '/var/lib/puppet/reports/' +){ + file { '/etc/cron.daily/puppet_reports_cleanup.sh': } - # clean up reports older than $puppetmaster_cleanup_reports days - file { '/etc/cron.daily/puppet_reports_cleanup.sh': - content => "#!/bin/bash\nfind /var/lib/puppet/reports/ -maxdepth 2 -type f -ctime +${puppetmaster_cleanup_reports} -exec rm {} \\;\n", - owner => root, group => 0, mode => 0700; + if $cleanup_older_than != 'absent' { + File['/etc/cron.daily/puppet_reports_cleanup.sh']{ + content => "#!/bin/bash\nfind ${puppet::puppetmaster::cleanup_reports::reports_dir} -maxdepth 2 -type f -ctime +${puppet::puppetmaster::cleanup_reports::cleanup_olderthan} -exec rm {} \\;\n", + owner => root, group => 0, mode => 0700, + } + } else { + File['/etc/cron.daily/puppet_reports_cleanup.sh']{ + ensure => absent, + } } } diff --git a/manifests/puppetmaster/cleanup_reports/disable.pp b/manifests/puppetmaster/cleanup_reports/disable.pp deleted file mode 100644 index 8636223..0000000 --- a/manifests/puppetmaster/cleanup_reports/disable.pp +++ /dev/null @@ -1,6 +0,0 @@ -class puppet::puppetmaster::cleanup_reports::disable inherits puppet::puppetmaster::cleanup_reports { - - File['/etc/cron.daily/puppet_reports_cleanup.sh']{ - ensure => absent, - } -} |