remount: Only remount if needed

Skip remounting filesystems that are already in the specified state.
This commit is contained in:
2021-10-30 16:41:58 -05:00
parent 689d53abfd
commit 98401b3c1e

View File

@@ -9,12 +9,12 @@
tasks:
- name: remount filesystems
command:
mount -oremount,{{ remount_state }} {{ item }}
mount -oremount,{{ remount_state }} {{ item.mount }}
warn=false
with_items: >-
{{
ansible_mounts
| selectattr('mount', 'in', remount_fs)
| map(attribute='mount')
| list
}}
when: not item.options.startswith(remount_state)