On Fri, Jun 3, 2011 at 12:52 AM, Luke Bigum <[email protected]> wrote:

>  Douglas,
>
> If you don't use a conditional somewhere, how are you going to decide what
> resources are declared on what clients?
>

I never said I didn't want to use conditionals somewhere.


>
> In that blog example, the classes are loaded based on the value of a fact
> reported by the Puppet client, in some ways "more reliable" than a variable
> defined in a Puppet master manifest. It's also not that bad a practice to
> conditionally include on variables declared at the top level (node.pp) -
> avoids variable scoping issues, a number of people on the list do that.
>

Yes, I understand that. We don't put our variables in the manifests. We put
them into csv files and use extlookup, which works great. However, I'm not
talking about the use of variables here. I'm talking about logic based on
operating system.

I'd also like to see something, maybe in the best practices document on the
Puppet Labs website indicating which is the correct way to handle specific
operating ystem logic. Having multiple classes (ie a lot of classes) per
module, means more files, which in my opinion, makes things confusing and
it's never really clear which is the best way to break things up. When you
have more than a few files, there's also a tendency to create subdirectories
under manifests/, and have stuff like module::A::B.pp.... and when you start
doing that, it becomes even more unclear how things should be arranged.

I've been working with puppet for over three years now and variable scoping
still isn't clear to me.


> Using sub classes based on operating system also gives you the added
> advantage of tracking down problems sooner, a Puppet error will look like:
>
> Foo::Redhat::File["foo.conf"] ...
>
> What approach would you like to see, conceptually? Maybe someone's done
> something similar with an ENC.
>
>
All I was asking for was a way to conditional manage a resource based on the
operating system. Something like:

file {

$operatingsystem ? {
  'centos' => {
    "/etc/somefile":
        source => ....
  },
  'default' => {}
}

Haven't tried it, but I don't think that's allowed.

Doug.

}

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to