summaryrefslogtreecommitdiff
path: root/manifests/puppetmaster/cleanup_reports.pp
blob: d25e8ac299b24db8832820ca5e3a115de7f76033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class puppet::puppetmaster::cleanup_reports(
  $cleanup_older_than = 'absent',
  $reports_dir = '/var/lib/puppet/reports/'
){
  file { '/etc/cron.daily/puppet_reports_cleanup.sh': }

  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,
    }
  }
}