Use the `selectattr()` filter. For example:

- set_fact:
   myobj: "{{ hostvars[inventory_hostname].ansible_mounts | selectattr('mount', 'equalto', '/') | list }}"
- debug: var=myobj

I work as a freelancer, so if you don’t want to do that kind of things yourself or don’t have the time, just drop me a line to hire me.

Leave a Reply

Your email address will not be published. Required fields are marked *