--- - name: Unmount Disks become: true block: - name: Disable Swap ansible.builtin.command: swapoff -a register: cleanup_swapoff_result changed_when: cleanup_swapoff_result.rc == 0 - name: Unmount /mnt if mounted ansible.builtin.command: umount -R /mnt register: cleanup_unmount_result changed_when: cleanup_unmount_result.rc == 0 failed_when: false - name: Verify /mnt is no longer mounted ansible.builtin.command: grep ' /mnt ' /proc/mounts until: cleanup_verify_unmount.rc != 0 retries: 5 delay: 5 register: cleanup_verify_unmount changed_when: false failed_when: cleanup_verify_unmount.rc not in [0, 1]