On Sep 11, 1:13 pm, Johnny Tan <[EMAIL PROTECTED]> wrote: > I'm using 3 environments in puppet. Each environment points > to different IPs and/or hostnames for things ranging from > nfs mounts to mail servers, etc. > > Ideally, I'd like to use the exact same file in each > environment, where the IPs/hostnames/etc get called via a > variable. > > Is there a best practice established in terms of where to > store such variables? It seems like each node section in > nodes.pp is the logical choice, but I suppose it's also > possible to put a case statement at the beginning of each > module that assigns the variables based on $environment.
I am probably way off base here but I wanted to do something similar (I think) although I'm not using environments, yet. I have multiple types of hardware (1U rack & small desktop box) that I want to manage with the same set of files. However the only way I can tell them apart is by hostname; factor doesn't really have any way to distinguish between the hardware. So what I did was create a GLOBAL module with a single init.pp and contents like this: class GLOBAL { $NODE_TYPE = $NOTE_TYPE $MANUFACTURER = "Dell" } Then in my node definition I set the variable $NODE_TYPE to something "desktop" and then include GLOBAL. Now I can reference $NODE_TYPE in any of my modules. For example, I'm installing a specific /etc/ modules with the following file { source => "common/etc/modules. $NODE_TYPE" }. All this juggling is necessary because of the scope of Puppet variables and the fact that it doesn't have global variables. Does this help? Is there a better way to do this? Am I totally off base here? Thanx! Richard --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---