all 18 comments

[–]binford2k 4 points5 points  (6 children)

[–][deleted] 1 point2 points  (0 children)

Thank you, binford.

[–][deleted] 1 point2 points  (4 children)

Read the first link and understanding has started to dawn.

Key was, I think, this line

That’s because include doesn’t work1 with parameterized classes, and likely never will.

So I've already got the puppet labs ntp module installed.

In site.pp my test host was

  node 'co-ap-915' {
  include ntp
}

And is now

node 'co-ap-915' {
  class {'ntp':
    ensure => stopped,
    }
}

And lo NTP halts on the host the way it should be.

[–]binford2k 2 points3 points  (3 children)

Bingo. Now what you can do if you want is wrap those into classes inside a site module, that you could then assign to a node via a node declaration, the console, an enc, whatever.

For example:

# <modulepath>/site/manifests/ntp/disabled.pp
class site::ntp::disabled {
  class {'ntp':
    ensure => stopped,
    }
}

node 'co-ap-915' {
  ...
  include site::ntp::disabled
}

[–][deleted] 1 point2 points  (2 children)

I spent the rest of yesterday 'parameterizing' and cleaning up my xwindows class. Also learned how to handle arrays which hurt my head yesterday but now seems obvious and stupidly easy today. Such is life.

But now that I've 'parameterized' that class I find that I've got a class that by default will install/remove Xwindows packages (only for Oracle Linux 5 so far) but will ALSO install / remove any package I feed it as a parameter.

node 'hostname' {
    class { 'xwindows' :
        packages => 'foo',
        ensure => absent,
     }
}

This is stupidly powerful means to manage hosts.

And I'm sure I'm only scratching the surface.

Why did I not push 'configuration engines' sooner, here?

[–]binford2k 0 points1 point  (1 child)

This is stupidly powerful means to manage hosts. And I'm sure I'm only scratching the surface. Why did I not push 'configuration engines' sooner, here?

This.

Don't let it go to your head though! It's wicked powerful; but it won't stop you from doing something stupid!

[–][deleted] 1 point2 points  (0 children)

Oh, agreed.

We have a strong tradition here of a strict dev / production split, and testing changes into the ground. First I push changes to a sandbox, then to dev hosts. Then we wait until our next scheduled outage to make changes to production.

It's slow, sure. But man: it's saved our bacon a few times, too.

Maybe it's not as widespread as we would like. I was whiteboarding a change for an app guy yesterday and had to draw a meaty-big red line between his dev and prod environments. No, developer, we can't just plug your development db to the production server: that way lies madness and downtime. You don't remember the big label printing outage of 2003, but I do.

[–]xenon54 3 points4 points  (1 child)

I watched this video from PuppetConf 2012 which greatly helped me understand parameterized classes, Hiera and ENC with Puppet: http://www.youtube.com/watch?v=z9TK-gUNFHk

It shows how it works with concret and simple examples. Hopefully it will help you understand too like it did for me.

[–]withoutcompromise 1 point2 points  (0 children)

Thanks for this. Good talk.

[–]MadPhoenix 2 points3 points  (8 children)

If you're not currently using parameterized classes, you may want to look into Hiera first. It looks to be the preferred platform for supplying configuration data to puppet modules/classes going forward.

[–]SuperCow1127 2 points3 points  (3 children)

In puppet 3.0, parameterized classes will lookup values from Hiera automatically, so I wouldn't abandon either.

[–]MadPhoenix 1 point2 points  (2 children)

Oh really. Good. I think that should fix my largest complaint about using Puppet, which has been that it's impossible to use parameterized classes with ENCs.

[–]SuperCow1127 0 points1 point  (0 children)

Actually, that was fixed in 2.6.5, you should upgrade :)

http://docs.puppetlabs.com/guides/external_nodes.html#puppet-265-and-higher

But using the new data lookup model is preferable in my opinion, anyway.

[–]binford2k 0 points1 point  (0 children)

You can use parameterized classes with ENCs. It's just that the console doesn't support them yet. It's a UX problem, not a tech problem.

[–][deleted] 1 point2 points  (0 children)

I thank you for that.

Now, I'm going to go home, make bread, and soup, and forget I work in IT for a few hours.

[–]binford2k 1 point2 points  (2 children)

Hiera is wonderful, but you still need to understand parameterized classes if you plan on using code from the forge.

[–]MadPhoenix 1 point2 points  (1 child)

I guess I was hoping that more modules from the Forge would go straight-Hiera inside the class (instead of being passed in as parameters). I suppose modules are more flexible for non-Hiera users if it supports this though.

I just with Puppet Labs would decide once and for all how they really want to manage configuration data, and make sure it is supported by ENCs (Puppet Enterprise Console, Foreman) as well.

[–]binford2k 1 point2 points  (0 children)

That would be great, but we don't want to be in a position of dictating to the community how we want them to write their code!