Puppet Class: puppet::agent::schedule
- Defined in:
- manifests/agent/schedule.pp
Summary
Puppet agent cron settingsOverview
Puppet agent cron settings
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'manifests/agent/schedule.pp', line 7
class puppet::agent::schedule (
Boolean $enable = true,
String $job_name = 'puppet agent run',
Array[String]
$job_arguments = [
'--onetime',
'--verbose',
'--no-daemonize',
'--no-usecacheonfailure',
'--detailed-exitcodes',
'--no-splay',
],
Boolean $reboot_job = true,
Boolean $file_backups_cleanup = true,
Integer $file_backups_ttl = 45,
)
{
$agent_run_minute = fqdn_rand(60, $job_name)
$agent_run_arguments = join($job_arguments, ' ')
if $enable {
cron { $job_name:
command => "/opt/puppetlabs/bin/puppet agent ${agent_run_arguments}",
hour => absent,
minute => $agent_run_minute,
month => absent,
monthday => absent,
user => 'root',
weekday => absent,
environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
}
}
if $enable and $reboot_job {
cron { "${job_name} on boot":
command => "/opt/puppetlabs/bin/puppet agent ${agent_run_arguments}",
special => 'reboot',
user => 'root',
environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
}
}
if $file_backups_cleanup {
cron { 'clientbucket cleanup':
command => "find /opt/puppetlabs/puppet/cache/clientbucket -type f -mtime +${file_backups_ttl} -delete",
hour => '5',
minute => fqdn_rand(60, 'clientbucket cleanup'),
}
}
}
|