configpolicy/remount.yml

31 lines
620 B
YAML

- hosts: all
gather_facts: false
tasks:
- name: clear facts
meta: clear_facts
- hosts: all
gather_facts: true
vars:
remount_state: rw
remount_fs:
- /
- /usr
- /opt
no_remount_fstype:
- squashfs
tasks:
- name: remount filesystems
command:
mount -oremount,{{ remount_state }} {{ item.mount }}
warn=false
with_items: >-
{{
ansible_mounts
| selectattr('mount', 'in', remount_fs)
| rejectattr('fstype', 'in', no_remount_fstype)
| list
}}
when: not item.options.startswith(remount_state)
tags:
- always