Files
k3s-ansible/roles/reset/tasks/umount_with_children.yml
Staf Wagemakers fe7bdf8cda Reorganize the filesystem umount order.
* Clean /var/lib/kubelet before /var/lib/rancher/k3s.
* Umount the filesystem tree in reverse order, to ensure the root
  is umounted last.

Signed-off-by: Staf Wagemakers <staf@wagemakers.be>
2021-01-24 11:04:30 +01:00

16 lines
454 B
YAML

---
- name: Get the list of mounted filesystems
shell: set -o pipefail && cat /proc/mounts | awk '{ print $2}' | grep -E "^{{ mounted_fs }}"
register: get_mounted_filesystems
args:
executable: /bin/bash
failed_when: false
changed_when: get_mounted_filesystems.stdout | length > 0
- name: Umount filesystem
mount:
path: "{{ item }}"
state: unmounted
with_items:
"{{ get_mounted_filesystems.stdout_lines | reverse | list }}"