[Novalug] Any puppet people out there?

John Place jplace at unixsage.com
Wed Mar 21 10:16:21 EDT 2012


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.



More information about the Novalug mailing list