|
27 | 27 | # ['templatedir'] - Template dir, if unset it will remove the setting.
|
28 | 28 | # ['configtimeout'] - How long the client should wait for the configuration to be retrieved before considering it a failure
|
29 | 29 | # ['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 |
30 | 32 | #
|
31 | 33 | # Actions:
|
32 | 34 | # - Install and configures the puppet agent
|
|
78 | 80 | $certname = undef,
|
79 | 81 | $http_proxy_host = undef,
|
80 | 82 | $http_proxy_port = undef,
|
| 83 | + $cron_hour = '*', |
| 84 | + $cron_minute = undef, |
81 | 85 | ) inherits puppet::params {
|
82 | 86 |
|
83 | 87 | if ! defined(User[$::puppet::params::puppet_user]) {
|
|
135 | 139 | $service_ensure = 'stopped'
|
136 | 140 | $service_enable = false
|
137 | 141 |
|
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 |
| 142 | + # Default to every 30 minutes - random around the clock |
| 143 | + if $cron_minute == undef { |
| 144 | + $time1 = fqdn_rand(30) |
| 145 | + $time2 = $time1 + 30 |
| 146 | + $minute = [ $time1, $time2 ] |
| 147 | + } |
| 148 | + else { |
| 149 | + $minute = $cron_minute |
| 150 | + } |
143 | 151 |
|
144 | 152 | cron { 'puppet-client':
|
145 | 153 | command => $puppet_run_command,
|
146 | 154 | 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 ], |
| 155 | + hour => $cron_hour, |
| 156 | + minute => $minute, |
150 | 157 | }
|
151 | 158 | }
|
152 | 159 | # Run Puppet through external tooling, like MCollective
|
|
0 commit comments