5

is there an option to set a node on hold (set it on noop), on the puppetmaster side? i am looking for a setting like in the example below. every node which has a variable called noop set to true in it's definition, won't be updated.

so example1.node.com will not have the test1 file after multiple puppet client runs but example2.node.com will have the file.

is there such an option? does another approach exist? (of course i can simple add a "_" to the node name and it will stop matching. i am looking for the official way.

node "example1.node.com"
{
    $noop = true
    file 
    {
        "/root/test1":
            content => "test",
            ensure => present,
    }
}

node "example2.node.com"
{
    file 
    {
        "/root/test1":
            content => "test",
            ensure => present,
    }
}
1
  • 2
    Not directly answering the question, but mcollective works really well for disabling puppet and also scheduling puppet runs on your nodes.
    – robbyt
    Jun 25, 2012 at 13:56

2 Answers 2

2

A common approach is to use an external node classifier to attach classes and/or attributes to nodes using your own business logic. It is documented on https://puppet.com/docs/puppet/latest/nodes_external.html

If you want to avoid applying anything on your file, you can add something like this in site.pp:

if $noop == true {
  fail('noop, I don't do anything!')
}

A bit more advanced. If you want puppet to avoid applying your manifests if /etc/noop exists on the system, you could create a custom fact:

Facter.add('noop') { setcode { File.exists? '/etc/noop' } }

then use in site.pp:

if $::noop == true {
  fail('noop, I don't do anything!')
0

I haven't found a way to set noop in the node definition such that I would see changes on the client (like the client agent was run with --noop), but the faster way for me to disable a node was:

Adding an underscore in front of the node name, like _example1.node.com which make will prevent to node from beeing matched by is fqdn, so the default config will be applied if one exists (see comment of @GargantuChet)

node "_example1.node.com"
{
    file 
    {
        "/root/test1":
            content => "test",
            ensure => present,
    }
}
2
  • 2
    Note that this is not enabling the agent's noop mode; it's preventing the Puppet server from finding any policy to apply to the node (based on node name, at least). The result would be that the agent run fails, or the server uses the default node configuration (if one exists) to build the catalog. None of this is necessarily a problem, but as someone learning Puppet it took me some time to notice the implications. Jul 2, 2018 at 16:34
  • 1
    @GargantuChet added some of your comment to the answer. thank you
    – c33s
    Jul 3, 2018 at 17:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .