Introduction
Hello Ninja, managing software configs can make us a bit tired sometimes, doesn’t it? For this reason, we will look into Puppet today. You can definitely play with this Puppet, but only inside your computers. On Linux and Windows, it's most typically used to pull the strings on numerous application servers simultaneously.
Puppet is a software configuration management and deployment solution that is free and open source. However, Puppet may also be used on a variety of platforms, such as IBM mainframes, Cisco routers, and Mac OS servers. In the article, we will read about the advanced concept of Managing nodes in Puppet.

Grouping and Classifying Nodes
Assign variables, parameters, and classes to nodes to configure them. It is known as classification.
To categorise nodes, we must:
1. Make node groups that contain nodes and preferences (variables, parameters, and classes) that we want to apply to the group's nodes.
2. Add nodes to the groups.
3. Declare classes and define the data that the node groups will use. Enabling data editing in the console may be required.
Nodes can be members of several node groups, and they inherit variables, class parameters and classes from all of them.
We can see nodes in a node group and Make modifications to node groups after classifying nodes.
Working of Node Group Inheritance
The hierarchy of node groupings is parent-child-grandchild. When nodes get introduced to a group, they inherit classes, parameters, variables, and rules from the group's ancestors as well as their immediate node group.
Classes: When a class gets declared in an ancestor node group, it gets implicitly declared in all node groups that descend from that group.
Class parameters and variables: Unless a different value gets set in a descendant node group, successor node groups inherit variables and class parameters from ancestors.
Dynamic node group rules: To be part of a group, a node must meet all of the rules in the immediate group and the rules in the ancestral groups.
Best Practices for Classifying Node Groups
To organise node groups, begin with high-level functional groups which match the organisation's business requirements and work our way down to smaller segments inside those categories.
Environment vs Classification Node Groups
Nodes are assigned environments such as test, development, or production by environment node groups.
Each node group in the environment:
- It must correlate to a Git branch in a control repo where targeted code deployments are desired. The name of the Git branch and the name of the environment group must be the same.
- Must be a node group child of All Environments. Furthermore, except for one-time run exception subgroups used for canary testing, the environment node groups cannot have any child groups.
- Classes or configuration data are not permitted.
Classification node groups give classification data, such as classes, parameters, and variables, to nodes. A node can be classified in more than one way.
- Each classification node group must be a descendant of All Nodes or a different classification group.
- In the group metadata, it must not get defined as an environment group.
Create Node Groups
Create node groups in the console to designate an environment or classification.
We have three actions to take to accomplish this:
1. In the console, navigate to Node groups and then Add group.
2. Configure the new node group's parameters.
3. Select Add.
As previously said, we can conduct the following:
Make environment node groups: Make our own environment node groups to target Puppet code deployments.
Make classification node groups: Nodes are assigned classification data via classification node groups.
Add nodes to Node Group
A node can get added to a node group in two ways.
Statically add nodes to a node group
Individual nodes can get pinned to node groups. Individual node pinning is only advised if the node group contains only a few nodes. If we need to add certain specific nodes that did not get captured by the dynamic rules of the group, nodes can get pinned.
Dynamically add nodes to a node group
If we need to add a large number of nodes to a group, Dynamically adding nodes to a node group using logical rules that automatically add and remove nodes from the node groups is more useful.
Writing Node Group Rules
We must give a Fact, Operator, and Value when creating a dynamic node group rule. These three components are necessary for adding nodes to a node group dynamically.
The Fact column specifies the fact that the rule should use. We can select known facts from a dropdown list, enter part of a string to filter the list, or utilise structured or trustworthy facts.
The Operator field expresses the connection between the fact and the Value. It specifies how the rule makes use of the fact.
The Fact value is described in the Value field. The Value can be a string, numeric, or regular expression, depending on the Operator and Fact.
Using Structured and Trusted Facts for Node Group Rules
Structured facts are linked facts that are grouped together, and trustworthy facts are a sort of structured fact.
Structured facts are hashes or arrays of connected facts.
Trusted facts are a form of structured fact that is immutable and taken from the certificate of a node.
Declare Classes
Classes are Puppet code blocks that configure nodes and assign resources to them.
Enable Data Editing in the Console
By default, new Puppet Enterprise (PE) installations allow us to edit configuration data in the console.
Define Data Used by Node Groups
The console provides several methods for specifying data used in the manifests.
- Set configuration data
- Set parameters
- Set variables
Set configuration data
In the same manner that Hiera data is used for automatic parameter search, configuration data set in the PE console is used. Although console configuration data takes precedence over Hiera data, data from both sources can be combined to configure nodes.
Set parameters
Parameters are stated resource-style, which implies they can be used to override other data. But, this override feature can produce class clashes and declaration errors, resulting in Puppet runs failing.
Set variables
Variables set in the console become top-scope variables, which are accessible to all Puppet manifests.
Variable-style syntax: The Value of the fact is interpolated using variable-style syntax.
Expression-style syntax: When we need to index into a fact, use expression-style syntax.
View Nodes in a Node Group
All nodes that currently match the rules provided for a node group can be viewed.
- Click Node groups in the console, and then we select the node group we want to see.
- We click on Matching nodes.





