How to get a list of disks from facts
Get the list of block devices from facts gathering
To just display the list of devices
- debug:
msg: "{{ ansible_devices.keys() }}"
Get list of devices with “Virtual disk” as model
- debug:
msg: '{{ ansible_devices | dict2items | selectattr("value.model","equalto","Virtual disk") | map(attribute="key") | list }}'
Leave a comment