Writing node group rules
To create a dynamic node group rule, you must specify a Fact, Operator, and Value.
These three fields are required to Dynamically add nodes to a node group.
The Fact field specifies the fact you want to the rule to use. You can select from the dropdown list of known facts, enter part of a string to filter the list, or use structured or trusted facts. For structured and trusted facts, select the initial value from the dropdown list, then type the rest of the fact:
- To descend into a hash, use periods (
.
) to designate path segments, such asos.release.major
ortrusted.certname
. - To specify an item in an array, put square brackets around the item's
numerical index, such as
processors.models[0]
ormountpoints./.options[0]
. - To identify path segments that have periods, dashes, spaces, or UTF
characters, put single or double quotes around the segment, such as
trusted.extensions."1.3.6.1.4.1.34380.1.2.1"
. - To use
trusted.extensions
short names, append the short name after a second period, such astrusted.extensions.pp_role
.
The Operator field describes the relationship between the Fact and the Value. It defines how the rule uses the fact (inclusively, exclusively, exactly, minimum, maximum, and so on).
The following table shows the operator symbols together with their respective meanings and the data types they can relate to.
Operator | Meaning | Supported data types |
---|---|---|
= | Is equal to | string, numeric, Boolean |
!= | Is not equal to | string, numeric, Boolean |
~ | Matches regular expression in | string |
!~ | Does not match regular expression in | string |
> | Is greater than | numeric |
>= | Is greater than or equal to | numeric |
< | Is less than | numeric |
<= | Is less than or equal to | numeric |
<: | Array contains | string, numeric, Boolean |
/: | Array does not contain | string, numeric, Boolean |
The >, >=, <, and <= operators require facts that have numeric values, such as dates, times, or version numbers.
The
~ and !~ operators require a
regular expression (regex) Value and are useful for matching
highly-specific node facts (for example, you want to find nodes with UUIDs starting
with 9999*
).
The <: and /: operators require facts with array values.
The Value field describes the relevant Fact value. Depending on the Fact and Operator, the Value can be a string, number, or regular expression.
Together these fields create a logical rule that PE uses to find matching nodes. If you have multiple dynamic rules for one node group, you can choose whether Nodes must match all rules or if Nodes may match any rule to be added to the group.