Skip to content

Commit f0d4cb3

Browse files
authored
Merge pull request #1833 from rundeck/attribute-enhancer
[RUN-4615] Document attribute substitution and presence operator for Attribute Match node enhancer
2 parents 211c974 + d7a6eed commit f0d4cb3

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

docs/manual/node-enhancers.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,34 @@ The attribute match enhancer is a way for you to add new attributes to various n
99
![Attribute Match](/assets/img/attribute_match.png)
1010

1111
- **Attribute Matches**
12-
: This is where you specify the attribute that you want to search for. By doing so, you can add new attributes to the nodes that match based off of what you input this section.
12+
: This is where you specify the attribute that you want to search for. By doing so, you can add new attributes to the nodes that match based off of what you input this section. Each match is entered on its own line using the format `key<operator>value`, where `key` is the attribute name. All matches must succeed for a node to be enhanced. See [Match Operators](#match-operators) for the supported operators.
1313

1414
- **Attributes to Add**
1515
: This is where you specify the new attributes that you wish to add to the nodes that matched the attributes you specified above. So, any attributes you put here will show up on all the nodes that match based off your Attribute Matches input.
1616

1717
- **Tags to Add**
1818
: This is where you specify any tags you want added to the nodes that match. You can enter numerous tags, all separated by a comma.
1919

20+
- **Enable Attribute Substitution**
21+
: When enabled, values in **Attributes to Add** and **Tags to Add** can reference a node's existing attributes using `${attribute}` syntax. For example, `image-${ec2.imageId}` as a tag, or `newattr=some-${oldattr}/${otherattr}` as an attribute. References to attributes that do not exist on the node resolve to an empty string. This option is disabled by default, so existing configurations are unaffected.
22+
2023
:::tip Heads Up
2124
If you would like to match the node name attribute, use 'nodename' instead of 'name'. The latter one works at 'Node filter' context only.
2225
:::
2326

27+
### Match Operators
28+
29+
The **Attribute Matches** field supports the following operators. Most operators compare an attribute against a `value`, while the presence operators only check whether an attribute exists.
30+
31+
| Operator | Match | Value |
32+
|---|---|---|
33+
| `==` | Equality match | Required |
34+
| `!=` | Inequality match | Required |
35+
| `=~` | Regular expression match | Required |
36+
| `!~` | Negative regular expression match | Required |
37+
| `~~` | Is present match (attribute exists) | Not used |
38+
| `!!` | Not present match (attribute is absent) | Not used |
39+
2440
### Attribute Match Examples
2541

2642
#### Assign a Node Executor to a Subset of Node Inventory
@@ -54,6 +70,23 @@ winrm-password-storage-path=keys/win_server1
5470
winrm-cmd=CMD
5571
```
5672

73+
#### Build New Attributes and Tags from Existing Attributes
74+
With **Enable Attribute Substitution** turned on, you can derive new attributes and tags from a node's existing attributes.
75+
This is useful when you want human-readable metadata based on values imported from a Node Source.
76+
77+
**Tag EC2 Nodes with their AMI ID:**<br>
78+
* Attribute Match: **`ec2.imageId~~`** (matches any node that has an `ec2.imageId` attribute) <br>
79+
* Tags to Add: **`image-${ec2.imageId}`** <br>
80+
* Enable Attribute Substitution: **checked**
81+
82+
**Combine Existing Attributes into a New Attribute:**<br>
83+
* Attribute Match: **`ec2.region~~`** <br>
84+
* Attributes to Add:
85+
```properties
86+
location=${ec2.region}/${ec2.availabilityZone}
87+
```
88+
* Enable Attribute Substitution: **checked**
89+
5790

5891
## Icon
5992

0 commit comments

Comments
 (0)