1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Additional simpler json_query documentation (#24041)

Since json_query treats backticks as delimiters for literals,
some of the examples in the json_query docs can be made a little
simpler. Rather than replacing such examples, demonstrate the
alternative
This commit is contained in:
Will Thames 2017-09-06 20:48:12 -07:00 committed by scottb
parent c3550b58ed
commit 0d69b63c01

View file

@ -286,6 +286,15 @@ This example shows ports from cluster1::
.. note:: You can use a variable to make the query more readable. .. note:: You can use a variable to make the query more readable.
Or, alternatively::
- name: "Display all server names from cluster1"
debug:
var: item
with_items: "{{domain_definition|json_query('domain.server[?cluster=`cluster`].port')}}"
.. note:: Here, quoting literals using backticks avoids escaping quotes and maintains readability.
In this example, we get a hash map with all ports and names of a cluster:: In this example, we get a hash map with all ports and names of a cluster::
- name: "Display all server ports and names from cluster1" - name: "Display all server ports and names from cluster1"