Linux – Best way to exclude node from puppet manifest

linuxpuppet

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?

Best Answer

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/ .

Related Topic