k3s-ansible/roles/reset/tasks/umount_with_children.yml
Julien DOCHE 88e1a43543 Make sure the reset role can be run with --check
We need to compute what mountpoints would be unmounted even when running with
--check

Signed-off-by: Julien DOCHE <julien.doche@gmail.com>
2021-02-19 00:19:50 +01:00

17 lines
474 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
check_mode: false
- name: Umount filesystem
mount:
path: "{{ item }}"
state: unmounted
with_items:
"{{ get_mounted_filesystems.stdout_lines | reverse | list }}"