If we don't do this, umounting devices declared like this
/dev/disk/by-id/ata-QEMU_HARDDISK_QM00001
will fail like:
umount: /dev/disk/by-id/ata-QEMU_HARDDISK_QM000011: mountpoint not found
Since we append '1' (partition 1), this won't work.
So we need to resolved the link to get something like /dev/sdb and then
append 1 to /dev/sdb1
Signed-off-by: Sébastien Han <seb@redhat.com>
Co-authored-by: Guillaume Abrioux <gabrioux@redhat.com>
with_items: "{{ devices }}"
register: osd_running
+ - name: resolve device(s) path(s)
+ command: readlink -f {{ item }}
+ changed_when: false
+ with_items: "{{ devices }}"
+ register: devices_canonicalize
+
- name: unmount all the osd directories
- command: umount "{{ item.0 }}"1
+ command: umount "{{ item.0.stdout }}"1
changed_when: false
failed_when: false
with_together:
- - "{{ devices }}"
+ - "{{ devices_canonicalize.results }}"
- "{{ osd_running.results }}"
when:
- item.1.get("rc", 0) != 0