diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-01-24 15:36:21 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-01-24 15:36:21 -0200 |
commit | 51c9eb050833f6927988fcd9465dc67e4c2bd4cf (patch) | |
tree | 207718df87a90d6dd6f3c133d1a43bd0a679e6b7 /manifests/master/update.pp | |
parent | 45c99882a470b33edf4789e67aca610ecd3eeda7 (diff) | |
download | puppet-puppet-51c9eb050833f6927988fcd9465dc67e4c2bd4cf.tar.gz puppet-puppet-51c9eb050833f6927988fcd9465dc67e4c2bd4cf.tar.bz2 |
Implementing post-update hook
Diffstat (limited to 'manifests/master/update.pp')
-rw-r--r-- | manifests/master/update.pp | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/manifests/master/update.pp b/manifests/master/update.pp index 4d6925c..fc30166 100644 --- a/manifests/master/update.pp +++ b/manifests/master/update.pp @@ -1,14 +1,7 @@ -class puppet::master::update { - # cron rule to update puppet config repository every 5 minutes - cron { "puppet-update": - command => "/usr/local/sbin/update-puppet-conf.sh > /dev/null 2>&1", - user => puppet, - minute => "*/5", - ensure => present, - require => [ File["/usr/local/sbin/update-puppet-conf.sh"], User["puppet"] ], - } - - # and the script to the cron-job above +class puppet::master::update( + $method = hiera('puppet::master::update::method', 'cron') +) { + # puppet update script file { "/usr/local/sbin/update-puppet-conf.sh": source => "puppet:///modules/puppet/update-puppet-conf.sh", owner => "puppet", @@ -17,12 +10,34 @@ class puppet::master::update { ensure => present, } - # TODO: use a post-update hook instead of the cronjob + # cron rule to update puppet config repository every 5 minutes + cron { "puppet-update": + command => "/usr/local/sbin/update-puppet-conf.sh > /dev/null 2>&1", + user => puppet, + minute => "*/5", + ensure => $method ? { + 'cron' => present, + default => absent, + }, + require => [ File["/usr/local/sbin/update-puppet-conf.sh"], User["puppet"] ], + } + + # use a post-update hook file { '/var/git/repositories/puppet.git/hooks/post-update': - ensure => absent, - mode => 0755, - owner => gitolite, + mode => 4750, + owner => puppet, group => gitolite, + ensure => $method ? { + 'cron' => absent, + default => present, + }, source => "puppet:///modules/puppet/post-update.sh", } + + # needed by the post-update hook above + if !defined(Package['procmail']) { + package { 'procmail': + ensure => present, + } + } } |