How does inheritance work?
Node groups inherit classes, class parameter values, variables, and rules from parent node groups. More specifically, inheritance works as follows:
- If an ancestor node group has a class, all descendent node groups will also have the class.
- Variables and class parameters
- Descendent node groups inherit class parameters and variables from ancestors unless a different value is set for the parameter or variable in the descendent node group. In this case, parameter and variable values set in the descendent node group override values set in ancestor node groups.
- A node group can only match nodes that all of its ancestors also match. Specifying rules in a child node group is a way of narrowing down the nodes in the parent node group to apply classes to a specific subset of nodes.
Note: If you use different values when classifying a node with the same class, parameter, or variable in another node group that shares inheritance, a conflict occurs. This conflict will cause the next Puppet run to fail. To see the classes and variables that have been assigned to a node through other node groups, in the PE console, go to Nodes > Inventory, click the node you’re interested in, and go to the Classes or Variables tab.
Tip: You can use the group children endpoint to review group lineage.