I accomplish this with a Environment variable. First you define
environments like PROD/PRE and then for each machine in an environment you
simply define that one variable (which for me is gather from an app
definition).
Than I setup a template for each environment.
--------------------------------------------------
From: "Mark Glossop" <mark.glos...@uwa.edu.au>
Sent: Thursday, September 23, 2010 12:40 PM
To: "Puppet Users" <puppet-users@googlegroups.com>
Subject: Re: [Puppet Users] best way to include a variable in many modules ?
On 24/09/10 1:03 AM, somebody called Tony G. (tony...@gmail.com) wrote
this:
http://projects.puppetlabs.com/projects/1/wiki/Resolv_Conf_Patterns
On Thu, Sep 23, 2010 at 11:36 AM, Daniel Maher <d...@witbe.net> wrote:
Hello,
I have two sites with a small number of machines at each. Each site is
functionally identical. I would like to set up a bunch of templates for
the various services at each site, with a handful of variables that
indicate which site the service is configured for. What would be "best
practice" way to accomplish this in Puppet ?
Consider :
s...@abc$ facter | grep domain
domain => abc.dom.ain
s...@abc$ cat /etc/resolv.conf
search abc.dom.ain
10.1.0.1
s...@xyz$ facter | grep domain
domain => xyz.dom.ain
s...@abc$ cat /etc/resolv.conf
search xyz.dom.ain
10.2.0.1
Thus i would like a template "resolv.conf.erb" :
search <%= site_name =>.dom.ain
10.<%= site_ip =>.0.1
I _could_ put something like this into _every_ class :
$site_name = $domain ? {
'abc.dom.ain' => 'abc',
'xyz.dom.ain' => 'xyz',
}
# etc...
That works, but frankly it's offensive in every way. There are clearly
other ways to go about it, so i am curious : for Puppet, what is the best
practice solution ?
Thank you all for your time and consideration.
Er, unless I'm missing something folks, the OP wasn't asking about
managing /etc/resolv.conf - AFAICT /etc/resolv.conf was only used by the
OP as an example. How to manage that file in a one-off case it wasn't the
objective.
So rehashing [paraphrasing mine]: what is Puppet "best practice" for
setting a handful of variables in a single location that then determine
the configuration of each client?
I'm posting because I'm interested in the answer too...and the answers so
far don't help answer it IMHO. If the answer is in the documentation
somewhere [I know I haven't found it so far...], well, a link to that doc
would be welcomed for my part.
Regards,
M.
--
Mark Glossop
IT Projects Officer [Murchison Widefield Array Radiotelescope]
ICRAR - International Centre for Radio Astronomy Research
Discovering the hidden Universe through Radio Astronomy
[cid:3368140823_18093341]
E: mark.glos...@icrar.org | W: http://icrar.org
P: +61 [0]8 6488 7744 | RSS: http://icrar.org/news/feed
M: +61 [0]406 351 336 | TW: http://twitter.com/icrar
--
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.