I would like to have puppet manage a file on each client. The file is
the same for all clients, but has two random numbers in it.
I assume I can use something like fqdn_rand(0-59) to generate a random
number between 0 and 59, right?
My main question is how to I get puppet to not think the file is
different every time puppetd runs? Would I use a template or a file
def and contents?
---
Thanks,
Allan Marcus
505-667-5666
neither will help. either you make your random function depending on a
seed, which means it isn't really random anymore. Or if you create the
file, replace => false might be your friend. But then for sure if you
change your other content it won't adjust them as well.
cheers pete
http://reductivelabs.com/trac/puppet/wiki/Recipes/cron
It also allows you to manually tweak the times each node runs.
-L
--
Larry Ludwig
Reductive Labs
Right. But with a caveat: the random number is not really random. In
fact the random generator is seeded with the node fqdn. Since this is a
constant, the generated random number won't change from run to run for a
given node.
> My main question is how to I get puppet to not think the file is
> different every time puppetd runs? Would I use a template or a file
> def and contents?
file {
"/path/to/random": content => fqdn_rand(60)
}
Will produce a file containing a random number that will never change
for a given node.
Or if you want to manage cron resource directly:
cron {
"mycron":
command => "/usr/local/bin/backup-logical",
hour => '*',
minute => fqdn_rand(60),
}
Hope that helps,
--
Brice Figureau
My Blog: http://www.masterzen.fr/
Right. But with a caveat: the random number is not really random. In
fact the random generator is seeded with the node fqdn. Since this is a
constant, the generated random number won't change from run to run for a
given node.
Or if you want to manage cron resource directly:
cron {
"mycron":
command => "/usr/local/bin/backup-logical",
hour => '*',
minute => fqdn_rand(60),
}
Usage: fqdn_rand(MAX, [SEED]). MAX is required and must be a positive integer; SEED is optional and may be any number or string.