On Tuesday, May 6, 2014 7:24:53 PM UTC-5, Phani wrote: > > How to dynamically assign variable to each node. If I had a 30 nodes and I > had a file which is managed by puppet and I need to assign different values > for each nodes from a array of values. How to do it other than making it > static. >
It depends. Does each node need a specific value? Do you need to avoid repetition or ensure that all possible values are used? What particular approaches are you disfavoring as "static"? Does it need to be scalable? Does the value assigned to each node need to remain constant? If you have exactly 30 values that you must assign to 30 nodes, with a different value for each node, then you probably have no choice but an approach relying on a static mapping from nodes to values. That mapping could be expressed via a separate node block per host, or in a hash in some class, or as a custom function, or in one of at least two different ways in hiera. Or it could be managed via an ENC, or in some cases it could be directly derived from hostnames alone. On the other hand, if the values don't need to be distributed uniformly to nodes, but do need to be stable on each node over time, then you should look into using Puppet's standard fqdn_rand()<http://docs.puppetlabs.com/references/3.5.latest/function.html#fqdnrand>function. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/09891d6f-9545-45e2-ac4d-5acb6d81d16e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.