Using node inheritance
Well-organized Puppet manifests are easy to read, and the node declarations (usually in manifests/nodes.pp
) are the most important part of the manifest. You should be able to tell by looking at a node declaration exactly what the node is for, and ideally also any special configuration it requires.
To make the node declarations as readable as possible, you can use node inheritance
to remove all duplicated code. For example, some things that might be common to all nodes are:
SSH configuration
NTP
Puppet
Backups
Nodes may also share configuration because they are in the same data center, or located at the same ISP or cloud provider. To avoid repeatedly including the same classes on lots of nodes, you can use node inheritance to tidy up your code.
How to do it…
The following steps will show you how to use node inheritance:
Modify your
manifests/nodes.pp
file to declare abase
node, which contains only the classes that all nodes need (these will probably be different for your infrastructure...