I am trying to iterate over ansible_mounts variable and print the mount points that are gathered during fact checking. Based on the documentation I would have expected the following to work:
- debug: msg={{item.mount}}
with_items: ansible_mounts
When I run the playbook with fact gathering enabled I get a number of errors. What is the correct way to print all of the file systems accessible to a host? It looks like ansible_mounts is a list of dictionaries so maybe I need to adjust my syntax? I'm currently running ansible 2.2.
This tasks shows the info you want:
- debug: msg="{{ item.mount }}"
with_items:
- "{{ ansible_mounts }}"
or
- debug: var=item.mount
with_items:
- "{{ ansible_mounts }}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With