Have you ever heard of JSON query language ? Well, if not take a look at this: https://jmespath.org/examples.html
This is absolutely brilliant when you're trying to get the exact information from the JSON results spitted by Ansible play runs especially, let me show you an example on how you can actually register the output to a variable and run your query on it.
Example:
- name: Sample Playbook
// Fill up your task
no_log: True
register: example_output
- name: Json Query
set_fact:
query_result:
example_output:"{{ example_output | json_query('results[*].name') }}"
Top comments (0)