Skip to content

Commit ef07de0

Browse files
committed
Allow new cron specification
1 parent b84b0ad commit ef07de0

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

manifests/agent.pp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
# ['templatedir'] - Template dir, if unset it will remove the setting.
2828
# ['configtimeout'] - How long the client should wait for the configuration to be retrieved before considering it a failure
2929
# ['stringify_facts'] - Wether puppet transforms structured facts in strings or no. Defaults to true in puppet < 4, deprecated in puppet >=4 (and will default to false)
30+
# ['cron_hour'] - What hour to run if puppet_run_style is cron
31+
# ['cron_minute'] - What minute to run if puppet_run_style is cron
3032
#
3133
# Actions:
3234
# - Install and configures the puppet agent
@@ -78,6 +80,8 @@
7880
$certname = undef,
7981
$http_proxy_host = undef,
8082
$http_proxy_port = undef,
83+
$cron_hour = '*',
84+
$cron_minute = '*/30',
8185
) inherits puppet::params {
8286

8387
if ! defined(User[$::puppet::params::puppet_user]) {
@@ -135,18 +139,11 @@
135139
$service_ensure = 'stopped'
136140
$service_enable = false
137141

138-
# Run puppet as a cron - this saves memory and avoids the whole problem
139-
# where puppet locks up for no reason. Also spreads out the run intervals
140-
# more uniformly.
141-
$time1 = fqdn_rand($puppet_run_interval)
142-
$time2 = fqdn_rand($puppet_run_interval) + 30
143-
144142
cron { 'puppet-client':
145143
command => $puppet_run_command,
146144
user => 'root',
147-
# run twice an hour, at a random minute in order not to collectively stress the puppetmaster
148-
hour => '*',
149-
minute => [ $time1, $time2 ],
145+
hour => $cron_hour,
146+
minute => $cron_minute,
150147
}
151148
}
152149
# Run Puppet through external tooling, like MCollective

0 commit comments

Comments
 (0)