I have a large number of Drupal sites on a Puppetized LAMP node. Each has a cronjob that needs to run hourly and is currently run on the hour. Wanting to spread the peak load this causes, I'm trying to spread the cronjobs to a random minute, preferable without manually configuring the minute value. The value should remain constant between Puppet runs. There's no need to take other nodes into account.
Here's an example from my cronjob manifest:
# Drupal cronjobs
cron { "www1.example.com":
command => "nice -n 19 drush -y -r /var/www/sites/http://ift.tt/1LZY0hl -l www1.example.com elysia-cron",
user => 'www-data',
hour => '*',
minute => '0',
}
cron { "www2.example.com":
command => "nice -n 19 drush -y -r /var/www/sites/http://ift.tt/1SSPzcQ -l www2.example.com elysia-cron",
user => 'www-data',
hour => '*',
minute => '0',
}
cron { "www3.example.com":
command => "nice -n 19 drush -y -r /var/www/sites/http://ift.tt/1LZXXlD -l www3.example.com elysia-cron",
user => 'www-data',
hour => '*',
minute => '0',
}
I tried Puppet's fqdn_rand() function, but this only randomizes across different nodes (due to using the fqdn), leading to the same value for each cronjob on the same node.
minute => fqdn_rand(60), # Same value for each cronjob :(
Thinking I could seed the fqdn_rand() function with the cronjob's name I tried to seed it with the name of the resource, which didn't work:
minute => fqdn_rand(60, $title), # Same value for each cronjob :(
minute => fqdn_rand(60, "${title}"), # Same value for each cronjob :(
I'm guessing the $title is not actually resolved but passed as the string '$title' to the function. In any case, not what I need.
I didn't find another function that would help me here, running Puppet 3.7.5. How can I solve this?
Aucun commentaire:
Enregistrer un commentaire