On Tue, 2009-08-11 at 13:07 -0600, Allan Marcus wrote:
> Hi,
> 
> 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?

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/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to