3

I would like to exclude a few nodes from a manifest.

I've read "How to exclude Puppet modules for a few nodes?", but I would like to achieve something similar to https://groups.google.com/forum/#!topic/puppet-users/CdeIUbMwAM4:

case $hostname {
        yourspecialhost: { $doit = false }
        default: { $doit = true }
}

if $doit {
        dowhatshouldbedoneinhere
}

Since this post is a bit old (2008), I was wondering if there are shorter or cleaner way to achieve the same goal nowadays?

Edit : We already try to be granular as we have specific modules for webserver or database. In our particular case, we built a module years ago about sshd.

Today, I have to build a server with very uncommon sshd feature (and different binary). Therefore, I'd like to exclude this server (and only this one) from sshd module.

Is it doable without Hiera? Is there a cleaner syntax than the quoted one?

2 Answers2

3

You probably want to get more granular with your classifications. For example, your "catch all" modules get included in the default node defined in sites.pp, modules that fit certain roles like webserver or database could be included with a case statement and external classifiers, and modules specific to a single server could be done with hiera or even host name matching.

http://nuknad.com/2011/02/11/self-classifying-puppet-nodes/ .

Jim
  • 31
  • 1
1

I found no cleaner syntax than the quoted one (at least not using Hiera).

Therefore I decided to do like quoted in the question.

I can confirm it works but I would have preferred something cleaner.

Morality : When you write a puppet module, never make the assumption that it will forever apply to every single server in your production.

If I record correctly, bcfg2 handles this situation much better.