Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional simpler json_query documentation #24041

Merged
merged 1 commit into from
Sep 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/docsite/rst/playbooks_filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,15 @@ This example shows ports from cluster1::

.. 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::

- name: "Display all server ports and names from cluster1"
Expand Down