A lot of puppet configurations recommend using puppet’s tidy directive to manage puppet reports. The problem with this though is that in order to delete the file, puppet will create a file directive in state.yaml. The state file grows pretty quickly then because of this and I’ve experienced it slowing down puppetruns after a certain point.

To get around this, I’ve written an exec directive that uses find to delete reports older than 10 days.

  # Delete reports that are 10 days old
  exec{'remove_old_reports':
    command => '/usr/bin/find . -name "*.yaml" -ctime +10 -delete',
    path    => ['/var/lib/puppet/reports']
  }

Leave a Reply