remount: PB to remount read-only filesystems

Many hosts have a read-only root filesystem, as well as some other
read-only paths that need to be remounted before configuration changes
can be made. The `remount.yml` playbook can be used to remount select
filesystems as either read-write or read-only (the default). It is
intended to be used before and after other playbooks, to ensure the
filesystems are in the correct state.
jenkins-master
Dustin 2018-04-15 13:45:38 -05:00
parent 7ce3c0e2c6
commit ffc8972abc
1 changed files with 20 additions and 0 deletions

20
remount.yml Normal file
View File

@ -0,0 +1,20 @@
- hosts: all
gather_facts: true
vars:
remount_state: ro
remount_fs:
- /
- /usr
- /opt
tasks:
- name: remount filesystems
command:
mount -oremount,{{ remount_state }} {{ item }}
warn=false
with_items: >-
{{
ansible_mounts
| selectattr('mount', 'in', remount_fs)
| map(attribute='mount')
| list
}}