diff options
-rw-r--r-- | manifests/cron/linux.pp | 8 | ||||
-rw-r--r-- | manifests/cron/openbsd.pp | 16 |
2 files changed, 17 insertions, 7 deletions
diff --git a/manifests/cron/linux.pp b/manifests/cron/linux.pp index c13c10a..46735e0 100644 --- a/manifests/cron/linux.pp +++ b/manifests/cron/linux.pp @@ -3,10 +3,14 @@ class puppet::cron::linux inherits puppet::linux { include puppet::cron::base if !$puppet_config { $puppet_config = '/etc/puppet/puppet.conf' } - if !$puppet_crontime { $puppet_crontime = '0,30 * * * *' } + if !$puppet_crontime { + $puppet_crontime_interval_minute = fqdn_rand(29) + $puppet_crontime_interval_minute2 = inline_template('<%= 30+puppet_crontime_interval_minute.to_i %>') + $puppet_crontime = '${puppet_crontime_interval_minute},${puppet_crontime_interval_minute2} * * * *' + } File['/etc/cron.d/puppetd.cron']{ source => undef, - content => "# run puppet\n$puppet_crontime root /usr/sbin/puppetd --onetime --no-daemonize --splay --config=$puppet_config --color false | grep -E '(^err:|^alert:|^emerg:|^crit:)'\n", + content => "# run puppet\n$puppet_crontime root /usr/sbin/puppetd --onetime --no-daemonize --config=$puppet_config --color false | grep -E '(^err:|^alert:|^emerg:|^crit:)'\n", } } diff --git a/manifests/cron/openbsd.pp b/manifests/cron/openbsd.pp index 56506bb..0de07ea 100644 --- a/manifests/cron/openbsd.pp +++ b/manifests/cron/openbsd.pp @@ -2,6 +2,12 @@ class puppet::cron::openbsd inherits puppet::openbsd { include puppet::cron::base if !$puppet_config { $puppet_config = '/etc/puppet/puppet.conf' } + if !$puppet_crontime { + $puppet_crontime_interval_minute = fqdn_rand(29) + $puppet_crontime_interval_minute2 = inline_template('<%= 30+puppet_crontime_interval_minute.to_i %>') + $puppet_crontime = '${puppet_crontime_interval_minute},${puppet_crontime_interval_minute2} * * * *' + } + Openbsd::Rc_local['puppetd']{ ensure => 'absent', } @@ -15,10 +21,10 @@ class puppet::cron::openbsd inherits puppet::openbsd { cron { 'puppetd_run': command => "/usr/local/sbin/puppetd --onetime --no-daemonize --splay --config=$puppet_config --color false | grep -E '(^err:|^alert:|^emerg:|^crit:)'", user => 'root', - minute => regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\1'), - hour => regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\2'), - weekday => regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\3'), - month => regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\4'), - monthday => regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\5') + minute => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\1'),','), + hour => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\2'),','), + weekday => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\3'),','), + month => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\4'),','), + monthday => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\5'),',') } } |