summaryrefslogtreecommitdiff
path: root/manifests/cron
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/cron')
-rw-r--r--manifests/cron/base.pp59
-rw-r--r--manifests/cron/linux.pp22
-rw-r--r--manifests/cron/openbsd.pp26
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'),',')
}
}