2020-07-22 18:43:06 +02:00
|
|
|
---
|
|
|
|
- name: Get the list of mounted filesystems
|
2023-11-07 22:35:08 +01:00
|
|
|
ansible.builtin.shell: set -o pipefail && cat /proc/mounts | awk '{ print $2}' | grep -E "^{{ mounted_fs }}"
|
2020-07-22 18:43:06 +02:00
|
|
|
register: get_mounted_filesystems
|
2020-07-22 20:48:40 +02:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2020-07-24 14:16:10 +02:00
|
|
|
failed_when: false
|
2020-07-22 18:43:06 +02:00
|
|
|
changed_when: get_mounted_filesystems.stdout | length > 0
|
2021-02-19 00:19:50 +01:00
|
|
|
check_mode: false
|
2020-07-22 18:43:06 +02:00
|
|
|
|
|
|
|
- name: Umount filesystem
|
2023-11-07 22:35:08 +01:00
|
|
|
ansible.posix.mount:
|
2020-07-22 18:43:06 +02:00
|
|
|
path: "{{ item }}"
|
|
|
|
state: unmounted
|
|
|
|
with_items:
|
2021-01-24 10:16:20 +01:00
|
|
|
"{{ get_mounted_filesystems.stdout_lines | reverse | list }}"
|