diff options
author | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2015-02-24 14:34:39 -0500 |
---|---|---|
committer | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2015-02-24 14:38:39 -0500 |
commit | 0bb70b28a7c7679d0e07fd75230d40203c0d53b5 (patch) | |
tree | acd91c59fea86768f81d98e262ed1677f646fa47 /manifests/cron | |
parent | beae5a608dd1b1d370917896d853a6b53ad73a45 (diff) | |
parent | 8584340c2aeac7d97a78b8303ab377b5049b80c2 (diff) |
Merge branch 'master' of git://git.puppet.immerda.ch/module-puppet
Conflicts:
files/master/config.ru
files/master/puppet.conf
manifests/base.pp
manifests/centos.pp
manifests/cron.pp
manifests/cron/base.pp
manifests/cron/linux.pp
manifests/debian.pp
manifests/init.pp
manifests/linux.pp
manifests/master/linux.pp
manifests/master/package/debian.pp
manifests/puppetmaster/base.pp
manifests/puppetmaster/centos.pp
manifests/puppetmaster/checklastrun.pp
manifests/puppetmaster/checklastrun/disable.pp
manifests/puppetmaster/cleanup_reports.pp
manifests/puppetmaster/cleanup_reports/disable.pp
manifests/puppetmaster/debian.pp
manifests/puppetmaster/package.pp
manifests/puppetmaster/package/base.pp
manifests/puppetmaster/passenger.pp
Diffstat (limited to 'manifests/cron')
-rw-r--r-- | manifests/cron/base.pp | 59 | ||||
-rw-r--r-- | manifests/cron/linux.pp | 22 | ||||
-rw-r--r-- | manifests/cron/openbsd.pp | 26 |
3 files changed, 50 insertions, 57 deletions
diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index 5c7a708..82483df 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -1,32 +1,47 @@ # manifests/cron/base.pp class puppet::cron::base inherits puppet::base { - + + case $::operatingsystem { + openbsd: { $stop_service = false } + default: { $stop_service = true } + } + + if !$puppet::cron::cron_time { + $crontime_interval_minute = fqdn_rand(29) + $crontime_interval_minute2 = inline_template("<%= 30+scope.lookupvar('puppet::cron::cron_time').to_i %>") + $crontime = "${crontime_interval_minute},${crontime_interval_minute2} * * * *" + } else { + $crontime = $puppet::cron::cron_time + } + + if $puppet::http_compression { + $http_compression_str = '--http_compression' + } else { + $http_compression_str = '' + } + Service['puppet']{ enable => false, } - case $operatingsystem { - openbsd: { - #it's already disabled - } - default: { - $puppet_majorversion = regsubst($puppetversion,'^(\d+\.\d+).*$','\1') - if $puppet_majorversion >= '2.6' { - Service['puppet']{ - ensure => stopped, - } - } else { - Service['puppet']{ - hasstatus => false, - pattern => 'puppetd', - } - # this works only on < 2.6 - exec { 'stop_puppet': - command => 'kill `cat /var/run/puppet/puppetd.pid`', - onlyif => 'test -f /var/run/puppet/puppetd.pid', - require => Service['puppet'], - } + if $puppet::cron::stop_service == true { + $puppet_majorversion = regsubst($::puppetversion,'^(\d+\.\d+).*$','\1') + if $puppet_majorversion != '0.25' { + Service['puppet']{ + ensure => stopped, + } + } else { + Service['puppet']{ + hasstatus => false, + pattern => 'puppetd', + } + # this works only on < 2.6 + exec { 'stop_puppet': + command => 'kill `cat /var/run/puppet/puppetd.pid`', + onlyif => 'test -f /var/run/puppet/puppetd.pid', + require => Service['puppet'], } } } } + diff --git a/manifests/cron/linux.pp b/manifests/cron/linux.pp index d0d0e92..3742d48 100644 --- a/manifests/cron/linux.pp +++ b/manifests/cron/linux.pp @@ -1,25 +1,11 @@ +# manifests/cron/linux.pp class puppet::cron::linux inherits puppet::linux { include puppet::cron::base - if !$puppet_config { $puppet_config = '/etc/puppet/puppet.conf' } - if $::puppet_http_compression { - $puppet_http_compression_str = '--http_compression' - } - - - 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} * * * *" - } - - include ::cron File['/etc/cron.d/puppetd']{ - source => undef, - content => "#run puppet\n${puppet_crontime} root output=\$(/usr/bin/puppet agent --onetime --no-daemonize --splay --config=/etc/puppet/puppet.conf --color false); ret=\$?; printf \"\\%s\" \"\$output\" | grep -E '(^err:|^alert:|^emerg:|^crit:)'; exit \$ret\n", - before => Service['puppet'], - ensure => present, - notify => Service['cron'] + source => undef, + content => "#run puppet\n${puppet::cron::base::crontime} root output=\$(/usr/bin/puppet agent --onetime --no-daemonize --splay --config=/etc/puppet/puppet.conf --color false ${puppet::cron::base::http_compression_str}); ret=\$?; printf \"\\%s\" \"\$output\" | grep -E '(^err:|^alert:|^emerg:|^crit:)'; exit \$ret\n", + before => Service['puppet'], } } diff --git a/manifests/cron/openbsd.pp b/manifests/cron/openbsd.pp index 084b022..0e4a813 100644 --- a/manifests/cron/openbsd.pp +++ b/manifests/cron/openbsd.pp @@ -1,32 +1,24 @@ class puppet::cron::openbsd inherits puppet::openbsd { - include puppet::cron::base - if !$puppet_config { $puppet_config = '/etc/puppet/puppet.conf' } - if $puppet_http_compression { $puppet_http_compression_str = '--http_compression' } - - 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} * * * *" - } + include puppet::cron::base Openbsd::Rc_local['puppetd']{ ensure => 'absent', } Cron['puppetd_check']{ - ensure => absent, + ensure => absent, } Cron['puppetd_restart']{ - ensure => absent, + ensure => absent, } cron { 'puppetd_run': - command => "/usr/local/bin/puppet agent --onetime --no-daemonize --config=$puppet_config --color false $puppet_http_compression_str | grep -E '(^err:|^alert:|^emerg:|^crit:)'", + command => "/usr/local/bin/puppet agent --onetime --no-daemonize --config=$puppet::config --color false ${puppet::cron::base::http_compression_str} | grep -E '(^err:|^alert:|^emerg:|^crit:)'", user => 'root', - 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'),',') + minute => split(regsubst($puppet::cron::base::crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\1'),','), + hour => split(regsubst($puppet::cron::base::crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\2'),','), + weekday => split(regsubst($puppet::cron::base::crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\3'),','), + month => split(regsubst($puppet::cron::base::crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\4'),','), + monthday => split(regsubst($puppet::cron::base::crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\5'),',') } } |