Created
June 13, 2018 18:21
-
-
Save serainville/b36e99b6d26ee9f41f839b5006447f84 to your computer and use it in GitHub Desktop.
Masterless Puppet Cron Job
This file contains 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
class puppet-cron ( | |
String $git_repo = "git@github.com/serainville/example.git" | |
){ | |
// Let's make sure the Puppet daemon isn't running. | |
service { "puppet": | |
ensure => stopped, | |
enable => false, | |
} -> | |
// Pull the latest commits to our Puppet module repository efvery 4 minutes. | |
cron { 'puppet-pull': | |
ensure => present, | |
command => "cd /etc/puppet ; /usr/bin/git fetch ${git_repo} ; /usr/bin/git checkout FETCH_HEAD -- environments/production/modules ; /usr/bin/git checkout FETCH_HEAD -- manifests/templates ; /usr/bin/git checkout FETCH_HEAD -- files", | |
user => 'root', | |
minute => '*/4', | |
} ~> | |
cron { 'puppet-apply': | |
ensure => present, | |
command => "/usr/bin/puppet apply /etc/puppet/site.pp" | |
user => 'root', | |
minute => '*/5', | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment