Skip to content

Commit e34871f

Browse files
Merge pull request #635 from lelutin/example_query_parameters
Add query that restricts resources per parameter value
2 parents 60e1087 + a8c8c55 commit e34871f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

_docs/pql_queries.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@ This is useful if you want to get a list of nodes with a specific profile or rol
107107
puppet query 'nodes[certname] {resources {type = "Class" and title = "CapitalizedClassname"}}'
108108
```
109109

110+
### Get all nodes that have a specific class using a specific parameter value
111+
112+
This query expands on the previous example but filters the results even more by
113+
requiring the required class to have one of its parameters be set to a
114+
predetermined value. For example, to obtain all nodes using a specific profile
115+
with a specific cluster name. Note how `parameters` is a field of the resources
116+
endpoint, but since it's a hash we need to use the dot-notation for accessing
117+
sub-elements.
118+
119+
```shell
120+
puppet query 'nodes[certname] {resources {type = "Class" and title = "CapitalizedClassname" and parameters.cluster_name = "ClusterName"}}'
121+
```
122+
110123
### Get a list of all roles / profiles
111124

112125
```shell

0 commit comments

Comments
 (0)