From 09c8eaf304d1075980d8d9143545f2f16a1db34d Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 5 Jun 2012 18:59:39 -0300 Subject: new style for 2.7 --- manifests/cron/base.pp | 24 +++++++++++++++++++----- manifests/cron/linux.pp | 13 ++----------- manifests/cron/openbsd.pp | 26 +++++++++----------------- 3 files changed, 30 insertions(+), 33 deletions(-) (limited to 'manifests/cron') diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index 7b40da6..42222d6 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -1,19 +1,33 @@ # manifests/cron/base.pp class puppet::cron::base inherits puppet::base { - case $operatingsystem { - debian: { if $lsbdistcodename != 'lenny' { $stop_service = true } else { $stop_service = false } } + case $::operatingsystem { + debian: { if $::lsbdistcodename != 'lenny' { $stop_service = true } else { $stop_service = false } } openbsd, ubuntu: { $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, } if $stop_service == true { - $puppet_majorversion = regsubst($puppetversion,'^(\d+\.\d+).*$','\1') - if $puppet_majorversion == '2.6' { + $puppet_majorversion = regsubst($::puppetversion,'^(\d+\.\d+).*$','\1') + if $puppet_majorversion == '2.6' { Service['puppet']{ ensure => stopped, } diff --git a/manifests/cron/linux.pp b/manifests/cron/linux.pp index bab9564..5452cc7 100644 --- a/manifests/cron/linux.pp +++ b/manifests/cron/linux.pp @@ -1,20 +1,11 @@ -# manifests/cron/linux.pp +# 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} * * * *" - } 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", + content => "#run puppet\n$puppet::cron::base::crontime root output=\$(/usr/sbin/puppetd --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'),',') } } -- cgit v1.2.3 From a81d6c371eef25a505e16cb89cb6c7e5a124e7fc Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 10 Jun 2012 18:26:55 -0300 Subject: stop the puppet service by default on cron --- manifests/cron/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/cron') diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index 42222d6..e12b5eb 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -25,7 +25,7 @@ class puppet::cron::base inherits puppet::base { enable => false, } - if $stop_service == true { + if $puppet::cron::stop_service == true { $puppet_majorversion = regsubst($::puppetversion,'^(\d+\.\d+).*$','\1') if $puppet_majorversion == '2.6' { Service['puppet']{ -- cgit v1.2.3 From aa345cb8f784ce5441367db7c4782000d80d365b Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 10 Jun 2012 19:38:29 -0300 Subject: we support now also 2.7 - 0.24 should not anymore be around --- manifests/cron/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/cron') diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index e12b5eb..e012731 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -27,7 +27,7 @@ class puppet::cron::base inherits puppet::base { if $puppet::cron::stop_service == true { $puppet_majorversion = regsubst($::puppetversion,'^(\d+\.\d+).*$','\1') - if $puppet_majorversion == '2.6' { + if $puppet_majorversion != '0.25' { Service['puppet']{ ensure => stopped, } -- cgit v1.2.3 From b36d79a7ae60660c4dc6ec5a176fc2a8abe70024 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 7 Apr 2013 23:20:16 +0200 Subject: also use new naming convention on linux --- manifests/cron/linux.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/cron') diff --git a/manifests/cron/linux.pp b/manifests/cron/linux.pp index 5452cc7..b90464a 100644 --- a/manifests/cron/linux.pp +++ b/manifests/cron/linux.pp @@ -5,7 +5,7 @@ class puppet::cron::linux inherits puppet::linux { File['/etc/cron.d/puppetd.cron']{ source => undef, - content => "#run puppet\n$puppet::cron::base::crontime root output=\$(/usr/sbin/puppetd --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", + content => "#run puppet\n$puppet::cron::base::crontime root output=\$(/usr/sbin/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'], } } -- cgit v1.2.3 From 679ddb1731b895021f6ee028910fe80a8cb88e66 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 8 Apr 2013 20:49:57 +0200 Subject: puppet is in bin not sbin --- manifests/cron/linux.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/cron') diff --git a/manifests/cron/linux.pp b/manifests/cron/linux.pp index b90464a..9b69dc1 100644 --- a/manifests/cron/linux.pp +++ b/manifests/cron/linux.pp @@ -5,7 +5,7 @@ class puppet::cron::linux inherits puppet::linux { File['/etc/cron.d/puppetd.cron']{ source => undef, - content => "#run puppet\n$puppet::cron::base::crontime root output=\$(/usr/sbin/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", + 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'], } } -- cgit v1.2.3 From 7bd09350025f19c4e2e79bafe6e91896b646a6b9 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 9 Jul 2014 23:21:09 +0200 Subject: get rid off lsb facts --- manifests/cron/base.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'manifests/cron') diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index e012731..82483df 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -2,8 +2,7 @@ class puppet::cron::base inherits puppet::base { case $::operatingsystem { - debian: { if $::lsbdistcodename != 'lenny' { $stop_service = true } else { $stop_service = false } } - openbsd, ubuntu: { $stop_service = false } + openbsd: { $stop_service = false } default: { $stop_service = true } } -- cgit v1.2.3 From b8bd7e5c9208feb09019a395374a04437a8122a4 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 30 Aug 2014 13:24:04 +0200 Subject: fix cron name globally + linting --- manifests/cron/debian.pp | 7 ------- manifests/cron/linux.pp | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) delete mode 100644 manifests/cron/debian.pp (limited to 'manifests/cron') 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 9b69dc1..3742d48 100644 --- a/manifests/cron/linux.pp +++ b/manifests/cron/linux.pp @@ -3,9 +3,9 @@ class puppet::cron::linux inherits puppet::linux { include puppet::cron::base - File['/etc/cron.d/puppetd.cron']{ + File['/etc/cron.d/puppetd']{ 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", + 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'], } } -- cgit v1.2.3