rvlinden
2011-Jul-23 20:18 UTC
[Puppet Users] Node or site.pp for global variables without dynamic lookup
Hi all, I am working on rewriting my entire puppet environment and try to ''fix'' ''Dynamic lookup'' as it will be deprecated in some time, but even after reading quite some docs and on the forum, it''s not really clear to me. What I have read so far, is that each variable must be fully-qualified or parameterized in a class. As a quick ''fix'' I thought I might just make them all fully-qualified, but that doesn''t seem to work within my current setup This is the way I already had configured my nodes node ''prodserver.mydomain.com'' inherits node ''prd'' which inherits node ''basenode node ''prodserver.mydomain.com'' inherits prd { .... } # End node node prd inherits basenode { $gblvar_zone = ''prd'' } # End node node basenode { $gblvar_puppetserver = ''puppet.mydomain.com'' $gblvar_domain = ''mydomain.com'' ..... } # End node Normally I would reference these variables in other classes like "$ {gblvar_zone}", but as this is a Dynamic lookup, I redefined them as "$ {::gblvar_zone}" or $::gblvar_zone. This however does not work. If I remove the lines from the node and put it site.pp eg: $gblvar_zone = ''prd'' it works fine. I really love the way I can inherit from nodes and define new or overrule existing variables. Is this a bug that $::varx works only from site.pp or is it by design and do I need to find another way to inherit and overrule variables ?? or can I just put all global variables in site.pp Regards, Rene -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
vagn scott
2011-Jul-23 23:14 UTC
Re: [Puppet Users] Node or site.pp for global variables without dynamic lookup
Node scope is not global scope. But, more interesting: On 07/23/2011 04:18 PM, rvlinden wrote:> I really love the way I can inherit from nodes and define new or > overrule existing variables. >I have been experimenting with puppet 2.7.1. It turns out that parameterized classes can inherit from other parameterized classes. Also, hashes behave well, can be passed as arguments, and can be augmented on the fly. Hashes that act as structures, that can be passed around and modified, make puppet feel like a ''real'' programming language. See attached. -- vagn -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
rvlinden
2011-Jul-23 23:19 UTC
[Puppet Users] Re: Node or site.pp for global variables without dynamic lookup
Thanks vagn, Will have a look at your suggestion On Jul 24, 1:14 am, vagn scott <vagnsc...@gmail.com> wrote:> Node scope is not global scope. But, more interesting: > > On 07/23/2011 04:18 PM, rvlinden wrote: > > > I really love the way I can inherit from nodes and define new or > > overrule existing variables. > > I have been experimenting with puppet 2.7.1. > It turns out that parameterized classes can inherit from other > parameterized classes. > Also, hashes behave well, can be passed as arguments, and can be > augmented on the fly. > Hashes that act as structures, that can be passed around and modified, > make puppet > feel like a ''real'' programming language. > > See attached. > > -- > vagn > > scopes.pp > 1KViewDownload > > scopes-and-hashes.pp > 1KViewDownload-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Seemingly Similar Threads
- Issue with template.pp
- Design, syntax question for passing values from node.pp
- ubuntu package installs
- RSync --compare-dest
- err: Could not retrieve catalog from remote server: Could not intern from pson: Could not convert from pson: Could not find relationship target "File[]"