Question

I am actually running a Puppet 2.7x setup to benchmark its capabilities using a group of test servers.

My actual site.pp :

node 'devnode' inherits 'deploy' {
    include 'server1.test.com'
    include 'server2.test.com'
    include 'server3.test.com'
    include 'server4.test.com'
}

node 'deploy' {
    include motd
    include ssh
    include ntp
}

doesn't work as intended (meaning: the motd, ssh and ntp modules are not applied to the nodes serverN.test.com located within the devnode node).

I previously had the following site.pp :

node /^server[1-4]\.test\.com$/ {
    include motd
    include ssh
    include ntp
}

but it lacks flexibility when I want to test a specific module on a single node.

Considering the following :

  1. I do not want to use an ENC yet (I am still in the process of learning Puppet basics)
  2. I'd like to keep this Puppet version (v2.7x) for logistic reasons inside my company
  3. the example given (serverN.test.com) doesn't unfortunately reflect the name of my company servers (whom all have 'unique' names with very little to no possibility for a regex to work, except maybe on the domaine test.com)
  4. I'd prefer to display all the nodes name (in devnode) to facilitate the inclusion/exclusion of nodes for the administrators

what are my options ?

Thanks in advance.

Was it helpful?

Solution

If you cannot formulate a regex, that is unfortunate. If the test.com domain is sufficient for your needs, you should use

node /.*\.test\.com$/ { ... }

instead of devnode (which makes little sense anyway, because it is only matched by agents whose unqualified names is "devnode").

If your fqdns are that chaotic, you may benefit from an ENC such as Foreman or the web interface of Puppet Enterprise after all. Such a classifier allows you to link classes to nodes flexibly. The hiera_include function will make Hiera a simplistic ENC even.

An option that forgos the ENC idea is of course to enumerate your fqdns in nodes.pp, perhaps introducing another inheritance layer.

node fqdn1.test.com inherits devnode { ... }
node fqdn2.test.com inherits devnode { ... }
...

OTHER TIPS

It's possible to specify couple node names per definition in site.pp :

node 'www1.example.com', 'www2.example.com', 'www3.example.com' { 
    include common 
    include apache, squid
} 

Disclaimer: Not sure that this feature available in Puppet 2.7

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top