Currently, we handle this by using variables that we set when parsing site.pp.  
We have a directory /etc/puppet/manifests/resources.  In site.pp, we have 
'import resources/*' before we have any node definitions.  One of the files in 
the resources directory may be something like sites.pp where we have something 
like the following:

case $sitecode {
        "FO": {
                $ldapserver = 'foldap.domain.com'
                $nameserver = ['192.168.2.2','192.168.2.3']
                $searchpath = ['domain.com','fo.domain.com']
        }

        "RT": { 
                $ldapserver = 'rtldap.domain.com'
                $nameserver = ['192.24.4.3','192.24.4.4']
                $searchpath = ['domain.com','rt.domain.com']
        }
}

Then just use the appropriate variable in your module.  We also use this 
approach to define site specific (or network specific) virtual resources so in 
the modules we just realize all resources of a certain type.

It would be very easy to create an environment for each site/network you have 
and then you could define a resources directory for each site/network instead 
of having one that's full of conditionals.

On Dec 10, 2009, at 5:19 AM, Kenneth Holter wrote:

> Hi.
>  
>  
> Some types of configurations need different parameters depending on which 
> environment/network the puppet client reside in. An example is DNS 
> configuration found in /etc/resolv.conf, which may vary depending on which 
> network the puppet client is on. Another example is LDAP client setup, may 
> also vary depending on the LDAP server infrastucture.
>  
> Is there any best practice on how to deal with these issues? I'm planning on 
> creating my own LDAP client module, and could need some advice on how to 
> solve this multiple environment/network problem. One way might be to define 
> variables such as "$environment = qass1.example.com" (or "$environment = 
> qass2.example.com" and so forth) in the node definition for every puppet 
> client, but maybe there's smarter ways of doing this.
>  
>  
> Best regards,
> Kenneth Holter
>  
>  
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-us...@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.

--

You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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.


Reply via email to