34 lines
1008 B
YAML
34 lines
1008 B
YAML
---
|
|
- name: Unmount Disks
|
|
become: true
|
|
block:
|
|
- name: Unmount the bootstrap package cache
|
|
ansible.posix.mount:
|
|
path: /mnt/var/cache
|
|
state: unmounted
|
|
|
|
- name: Remove the bootstrap package cache so it is not sealed into the image
|
|
ansible.builtin.file:
|
|
path: /mnt/.bootstrap-cache
|
|
state: absent
|
|
|
|
- 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]
|