diff options
-rw-r--r-- | manifests/cron.pp | 2 | ||||
-rw-r--r-- | manifests/cron/debian.pp | 7 | ||||
-rw-r--r-- | manifests/cron/linux.pp | 20 | ||||
-rw-r--r-- | manifests/linux.pp | 10 | ||||
-rw-r--r-- | manifests/puppetmaster/checklastrun.pp | 31 |
5 files changed, 37 insertions, 33 deletions
diff --git a/manifests/cron.pp b/manifests/cron.pp index f593a00..8cb4644 100644 --- a/manifests/cron.pp +++ b/manifests/cron.pp @@ -1,6 +1,6 @@ class puppet::cron inherits puppet { case $operatingsystem { - debian: { include puppet::cron::debian } + debian,ubuntu: { include puppet::cron::linux } openbsd: { include puppet::cron::openbsd } freebsd: { include puppet::cron::freebsd } default: { diff --git a/manifests/cron/debian.pp b/manifests/cron/debian.pp deleted file mode 100644 index 0b4bd61..0000000 --- a/manifests/cron/debian.pp +++ /dev/null @@ -1,7 +0,0 @@ -class puppet::cron::debian inherits puppet::cron::linux { - - File['/etc/cron.d/puppetd.cron']{ - path => '/etc/cron.d/puppetd', - } - -} diff --git a/manifests/cron/linux.pp b/manifests/cron/linux.pp index 5003559..f5b0ebb 100644 --- a/manifests/cron/linux.pp +++ b/manifests/cron/linux.pp @@ -1,21 +1,25 @@ -# 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_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} * * * *" } - File['/etc/cron.d/puppetd.cron']{ - source => undef, - content => "#run puppet\n$puppet_crontime root output=\$(/usr/sbin/puppetd --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 + include ::cron + + File['/etc/cron.d/puppetd']{ + source => undef, + content => "#run puppet\n${puppet_crontime} root output=\$(/usr/sbin/puppetd --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'] } } diff --git a/manifests/linux.pp b/manifests/linux.pp index d17b386..e752788 100644 --- a/manifests/linux.pp +++ b/manifests/linux.pp @@ -13,12 +13,12 @@ class puppet::linux inherits puppet::base { Service['puppet']{ require => Package[puppet], } - + + file { '/etc/cron.d/puppetd': + ensure => absent + } + # For backwards compatibility, remove this so that the cron is not duplicated file { '/etc/cron.d/puppetd.cron': - source => [ "puppet:///modules/site_puppet/cron.d/puppetd", - "puppet:///modules/puppet/cron.d/puppetd.${operatingsystem}", - "puppet:///modules/puppet/cron.d/puppetd" ], - owner => root, group => 0, mode => 0644, ensure => absent } } diff --git a/manifests/puppetmaster/checklastrun.pp b/manifests/puppetmaster/checklastrun.pp index 93ed8b9..5a1b1c8 100644 --- a/manifests/puppetmaster/checklastrun.pp +++ b/manifests/puppetmaster/checklastrun.pp @@ -1,25 +1,32 @@ class puppet::puppetmaster::checklastrun { - $puppet_lastruncheck_ignorehosts_str = $puppet_lastruncheck_ignorehosts ? { - '' => '', - undef => '', - default => "--ignore-hosts ${puppet_lastruncheck_ignorehosts}" + $puppet_lastruncheck_ignorehosts_str = $::puppet_lastruncheck_ignorehosts ? { + '' => '', + undef => '', + default => "--ignore-hosts ${::puppet_lastruncheck_ignorehosts}" } - $puppet_lastruncheck_timeout_str = $puppet_lastruncheck_timeout ? { - '' => '', - undef => '', - default => "--timeout ${puppet_lastruncheck_timeout}" + $puppet_lastruncheck_timeout_str = $::puppet_lastruncheck_timeout ? { + '' => '', + undef => '', + default => "--timeout ${::puppet_lastruncheck_timeout}" } + include ::cron + file{ '/usr/local/sbin/puppetlast': - source => [ "puppet:///modules/puppet/master/lastruncheck" ], - owner => root, group => 0, mode => 0700; + source => [ 'puppet:///modules/puppet/master/lastruncheck' ], + owner => root, + group => 0, + mode => '0700'; '/etc/cron.d/puppetlast.cron': content => "${puppetmaster_lastruncheck_cron} root /usr/local/sbin/puppetlast ${puppet_lastruncheck_timeout_str} ${puppet_lastruncheck_ignorehosts_str} ${$puppet_lastruncheck_additionaloptions}\n", - require => File["/usr/local/sbin/puppetlast"], - owner => root, group => 0, mode => 0644, + require => File['/usr/local/sbin/puppetlast'], + owner => root, + group => 0, + mode => '0644', + notify => Service['cron'] } } |