[Puppet Users] Variable Scoping = Root Canal

2010-06-27 Thread Douglas Garstang
I've been struggling with puppet variable scope all day, well, for several months actually. I think I have pretty simple requirements. For any given node, I want to be able to set a series of variables and include a set of classes, based on three different aspects of a node, being physical locatio

Re: [Puppet Users] Variable Scoping = Root Canal

2010-06-27 Thread Steve Neuharth
I think you could do: node 'node1.fr.xxx.com' { include facility::sjc $my_ldap_server = $facility::sjc::ldap_server include ldap::client } On Sun, Jun 27, 2010 at 2:02 AM, Douglas Garstang wrote: > I've been struggling with puppet variable scope all day, well, for > several months actually. >

Re: [Puppet Users] Variable Scoping = Root Canal

2010-06-27 Thread Douglas Garstang
On Sun, Jun 27, 2010 at 11:28 AM, Steve Neuharth wrote: > I think you could do: > > node 'node1.fr.xxx.com' { >  include facility::sjc >  $my_ldap_server = $facility::sjc::ldap_server >  include ldap::client > } That seems to work. Not pretty though. I'll go see if it causes any other problems, a

Re: [Puppet Users] Variable Scoping = Root Canal

2010-06-27 Thread Steve Neuharth
Yup, I hear ya. This was a pain until I realized that the only variables defined in nodes are inherited from node to node. The variables defined in classes that are included by the node must be expressed using the variable's full context. I just ended up mapping certain variables to other variabl

Re: [Puppet Users] Variable Scoping = Root Canal

2010-06-28 Thread Alan Barrett
On Sun, 27 Jun 2010, Douglas Garstang wrote: > node 'node1.fr.xxx.com' { > include facility::sjc > include ldap::client > } > > In this example, variables defined in facility::sjc are not visible in > ldap::client (in this case, it would be the IP address of the local > LDAP server). I'd prob

Re: [Puppet Users] Variable Scoping = Root Canal

2010-06-28 Thread Douglas Garstang
On Mon, Jun 28, 2010 at 4:07 AM, Alan Barrett wrote: > On Sun, 27 Jun 2010, Douglas Garstang wrote: >> node 'node1.fr.xxx.com' { >>   include facility::sjc >>   include ldap::client >> } >> >> In this example, variables defined in facility::sjc are not visible in >> ldap::client (in this case, it

Re: [Puppet Users] Variable Scoping = Root Canal

2010-06-28 Thread Alan Barrett
On Mon, 28 Jun 2010, Douglas Garstang wrote: > >node 'node1.fr.xxx.com' { > >$facility_name = "sjc" > >include ldap::client > > Not gonna work. It's pointless to define the facility at the node level. You have to set the facility name somewhere. If not at the node level, then

Re: [Puppet Users] Variable Scoping = Root Canal

2010-06-28 Thread Trevor Hemsley
This actually looks like a prime candidate for a custom written fact so that you don't have to faff about like this all over the place. On 28/06/2010 17:28, Alan Barrett wrote: > On Mon, 28 Jun 2010, Douglas Garstang wrote: >>>node 'node1.fr.xxx.com' { >>>$facility_name = "sjc" >>>

Re: [Puppet Users] Variable Scoping = Root Canal

2010-06-28 Thread Douglas Garstang
On Mon, Jun 28, 2010 at 9:28 AM, Alan Barrett wrote: > On Mon, 28 Jun 2010, Douglas Garstang wrote: >> >    node 'node1.fr.xxx.com' { >> >        $facility_name = "sjc" >> >        include ldap::client >> >> Not gonna work. It's pointless to define the facility at the node level. > > You have to s