2020-07-22 18:43:06 +02:00
|
|
|
---
|
|
|
|
- name: Get the list of mounted filesystems
|
2020-07-22 20:48:40 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
- name: Umount filesystem
|
|
|
|
mount:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: unmounted
|
|
|
|
with_items:
|
|
|
|
"{{ get_mounted_filesystems.stdout_lines }}"
|