I've read a lot of different sources, and I just can't decide what is the best way to handle deployment of modules to nodes/hosts nor have I gotten some of them to work. I have created everything in modules.
That being said, when I was testing I was deploying the modules like this;
node 'basetesting' {
include fail2ban
include nrpe
}
node 'test-dev' inherits 'basetesting' {
}
However, I've created a lot of modules and realized that my servers will vary on what their role is (application, web, etc). There is a set of base requirements all of them have. So I essentially want a node to have the base. Then have their required modules, which I believe would look something like this;
node 'basetesting' {
include fail2ban
include nrpe
}
node 'test-dev' inherits 'basetesting' {
include httpd
}
Then I realized ... that I would have to make a definition for every single node. Which, I guess wouldn't be bad, but I imagine if you had 50+ servers, that might become quite the nodes.pp file.
Is there a better way to do this?
The solution I use is regexing the node names:
node 'www\d.domain.com' inherits 'webserver' {}
That way all of my www1, www2, www3, etc get the right setup. Using descriptive server names also makes it easier for new people to understand how your system as a whole works.