Skip to content

Instantly share code, notes, and snippets.

@fvoges
Forked from npwalker/puppet_cron
Last active August 29, 2015 14:27
Show Gist options
  • Save fvoges/4ad5d47ea00841f348ce to your computer and use it in GitHub Desktop.
Save fvoges/4ad5d47ea00841f348ce to your computer and use it in GitHub Desktop.
A puppet manifest to disable the pe-puppet daemon and instead enable a cron job to run puppet with a random starting time. This will help avoid a thundering herd problem.
$first_run = fqdn_rand(30)
$second_run = fqdn_rand(30) + 30
cron { 'cron.puppet':
command => "/opt/puppet/bin/puppet agent -t > /dev/null",
user => "root",
minute => [ $first_run, $second_run ],
}
# make sure we haven't started the pe-puppet daemon ever
# this might break a report on an agent that triggers this via a daemonized run.
service { 'pe-puppet':
enable => false,
ensure => stopped,
require => Cron['cron.puppet'],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment