Cleanup refactor and libvirt removal tooling
This commit is contained in:
23
roles/cleanup/tasks/unmount.yml
Normal file
23
roles/cleanup/tasks/unmount.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- 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]
|
||||
Reference in New Issue
Block a user