Cleaning up old files
Puppet's tidy
resource will help you clean up old or out-of-date files, reducing disk usage. For example, if you have Puppet reporting enabled as described in the section on generating reports, you might want to regularly delete old report files.
How to do it…
Let's get started:
Modify your
manifests/nodes.pp
file as follows:node 'cookbook' { tidy { '/var/lib/puppet/reports': age => '1w', recurse => true, } }
Run Puppet:
Notice: /Stage[main]//Node[cookbook]/Tidy[/var/lib/puppet/reports]: Tidying File[/var/lib/puppet/reports/cookbook.compute-1.internal/201303151215.yaml] Notice: /Stage[main]//Node[cookbook]/Tidy[/var/lib/puppet/reports]: Tidying File[/var/lib/puppet/reports/cookbook.compute-1.internal/201305151327.yaml] Notice: /Stage[main]//Node[cookbook]/Tidy[/var/lib/puppet/reports]: Tidying File[/var/lib/puppet/reports/cookbook.compute-1.internal/201304121116.yaml] Notice: /Stage[main]//Node[cookbook]/Tidy[/var/lib/puppet/reports]: Tidying File...