[Novalug] Any puppet people out there?
Steve Bambling
smbambling@gmail.com
Thu Mar 22 07:26:58 EDT 2012
I think John nailed it, this is basically what we do for some of our
classes. I would also take a good look at the ruby erb templates, this
gives you the ability to cascade setting in place of having a bunch of
static files.
For example:
file { "/etc/sudoers":
mode => 0440,
content => $template ? {
'default' => template("sudo/sudoers-default.erb"),
'qa' => template("sudo/sudoers-qa.erb"),
'dev' => template("sudo/sudoers-dev.erb"),
Inside the sudoers-dev you can call the default template.
<%= scope.function_template("sudo/sudoers-default.erb") %>
%sudodev ALL=(ALL) ALL
This way if a sysadmin leaves or you need to modify the default setting
your not doing it across multiple files.
v/r
STEVE
On Wed, Mar 21, 2012 at 10:16 AM, John Place <jplace@unixsage.com> wrote:
> Note: I am no puppet wizard :-)
>
> Not quite following what you are trying to do but you may be looking for
> the realize function:
> http://docs.puppetlabs.com/references/2.7.9/function.html#realize
>
> Allows you to "cherry pick" out of a collection...
>
> Of if you are making decisions based on other variables, for instance
> the following was to use a internal repo in an environment that used 3
> different flavours of linux (note OEL is "unbreakable" linux)
>
> case $operatingsystem {
> centos,fedora,OEL: {
> file { "/etc/yum.repos.d/MyCompany.repo":
> ensure => present,
> owner => root,
> group => root,
> mode => 644,
> source => $operatingsystem ? {
> centos =>
> "puppet:///genericsystem/etc/yum.repos.d/CentOS-MyCompany.repo",
> fedora =>
> "puppet:///genericsystem/etc/yum.repos.d/Fedora-MyCompany.repo",
> OEL =>
> "puppet:///genericsystem/etc/yum.repos.d/OEL-MyCompany.repo",
> }
> }
> }
> }
>
>
> Sorry if I am missing your need...
>
> Thanks
> John
>
> On 03/21/2012 10:03 AM, Gopher wrote:
> > What I need is someone who can help me understand how to use
> > parameterized classes properly. With Puppet's declarative language, I
> > just can't figure out how to work it so box X gets a class with one set
> > of parameters and box Y gets the same class using a different set of
> > parameters. And I can't figure out how to do this without getting
> > 'Duplicate definition' errors all over the place.
>
> _______________________________________________
> Novalug mailing list
> Novalug@calypso.tux.org
> http://calypso.tux.org/mailman/listinfo/novalug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.firemountain.net/pipermail/novalug/attachments/20120322/5f8ab998/attachment.htm>
More information about the Novalug
mailing list