On Fri, Dec 2, 2011 at 7:46 AM, Sans <r.santanu....@gmail.com> wrote:
> How can I globally declare a variable, so that it can be used across > the manifests and templates? I tried putting all my variables: > > --------------------------------- > $my_var1 = 'my 1st variable' > $my_var2 = 'my 2nd variable" > --------------------------------- > > in a file, e.g. called "settings.pp" and then try to accessing them > from another manifests after importing settings.pp, but that's > absolutely not working. I'm writing a costume module for our and group > and I want individual user only to edit the "settings.pp" to put their > own value to make this module work for them. How can I make that > happen? Cheers!! > > Assuming you did something like: # modulepath/modules/settings/manifests/init.pp class settings { $my_var1 = "myvar1" } and include the class "settings", from other classes you can refer to it as: $settings::my_var1 Does that help? I noticed you used the word "import". The most frictionless way to use Puppet these days is to avoid import, and to instead structure your classes in modules, and use the autoloader and "include" classes rather than importing manifest files. -- Nigel Kersten Product Manager, Puppet Labs -- 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.