Last active
October 7, 2016 21:03
-
-
Save npwalker/7536301 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$runinterval = 30 #minutes | |
$first_run = fqdn_rand($runinterval) | |
$second_run = $first_run + $runinterval | |
cron { 'cron.puppet': | |
command => "/opt/puppetlabs/bin/puppet agent -t > /dev/null", | |
user => "root", | |
minute => [ $first_run, $second_run ], | |
} | |
# make sure we haven't started the puppet daemon ever | |
# this might break a report on an agent that triggers this via a daemonized run. | |
service { '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