summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Filion <lelutin@gmail.com>2011-08-23 18:04:45 -0400
committerGabriel Filion <lelutin@gmail.com>2011-08-23 18:04:45 -0400
commitc0afea193ef40786fb61cbab24f6e9366f157264 (patch)
tree385e1353ab97d4b0622e5cb0ef5de07dcd06b1b4
parent000165503f79e6214047ba2622bdabf4176a68a0 (diff)
Add partial freebsd cron job support
The puppet::cron::freebsd class is almost identical to the puppet::cron::openbsd one, but there is no cron job to remove, and the /etc/rc.conf mechanism doesn't exist yet for FreeBSD. Signed-off-by: Gabriel Filion <lelutin@gmail.com>
-rw-r--r--manifests/cron.pp1
-rw-r--r--manifests/cron/freebsd.pp23
2 files changed, 24 insertions, 0 deletions
diff --git a/manifests/cron.pp b/manifests/cron.pp
index 693a430..9a632ff 100644
--- a/manifests/cron.pp
+++ b/manifests/cron.pp
@@ -5,6 +5,7 @@ class puppet::cron inherits puppet {
linux: { include puppet::cron::linux }
debian: { include puppet::cron::debian }
openbsd: { include puppet::cron::openbsd }
+ freebsd: { include puppet::cron::freebsd }
default: { include puppet::cron::base }
}
}
diff --git a/manifests/cron/freebsd.pp b/manifests/cron/freebsd.pp
new file mode 100644
index 0000000..5ff3419
--- /dev/null
+++ b/manifests/cron/freebsd.pp
@@ -0,0 +1,23 @@
+class puppet::cron::freebsd inherits puppet::freebsd {
+
+ include puppet::cron::base
+ 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} * * * *"
+ }
+
+ #TODO ensure that the service is disabled in /etc/rc.conf[.local]
+
+ cron { 'puppetd_run':
+ command => "/usr/local/bin/puppet agent --onetime --no-daemonize --config=${puppet::puppet_config} --color false $puppet_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'),',')
+ }
+}