--- - name: Get Mounts hosts: all become: true gather_facts: false vars: shrink_lv_devices: - device: /dev/mapper/test--vg01-test--lv01 size: 40G - device: /dev/mapper/test--vg02-test--lv02 size: 40G tasks: - name: Retrieve mount points ansible.builtin.setup: gather_subset: - "!all" - "!min" - mounts - name: Capture LVM device details ansible.builtin.set_fact: shrink_lv_mount_info: "{{ shrink_lv_mount_info | default([]) + \ [ansible_facts.mounts | selectattr('device', 'equalto', item.device)] }}" loop: "{{ shrink_lv_devices }}" loop_control: label: "{{ item.device }}" - name: Debug shrink_lv_mount_info ansible.builtin.debug: var: shrink_lv_mount_info