summaryrefslogtreecommitdiff
path: root/manifests/cron/linux.pp
blob: f5b0ebbceb38dbb5203a6ba6fa4ffd6578e39bf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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/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']
  }
}