I have a include_vars file with the below entries in listings.yml
`
I have a include_vars file with the below entries in listings.yml
`
The variables from the file are assigned into the dictionary "user1". Fix the
variables' references
- debug:
msg: "Name {{ user1[item].0.name }} on path {{ user1[item].0.path }}"
loop:
- "{{ inventory_hostname }}"
With single item the loop is not necessary
- debug:
msg: "Name {{ user1[inventory_hostname].0.name }} on
path {{ user1[inventory_hostname].0.path }}"
HTH,
-vlado
@Vladimir this prints only the first name and path under the hostname.
I wish to loop all name and path under the given host.
Try this
- debug:
msg: "Name {{ item.name }} on path {{ item.path }}"
loop: "{{ user1[inventory_hostname] }}"
HTH,
-vlado