ansible docs
requirements: pip install jmespath
---
- hosts: localhost
gather_facts: false
vars:
parent_var:
child_list: [{name: 'test'},{ name: 'test2'}]
tasks:
- debug:
msg: "{{ parent_var | json_query('child_list[].name') }}"
ansible-playbook list_test.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] *****************************************
TASK [debug] ****************************************
ok: [localhost] =>
msg:
- test
- test2
Special thanks to https://github.com/derekmwright
Top comments (0)