From ffc8972abc2c0e32eebbd8d748b9b6b4459ecd8c Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sun, 15 Apr 2018 13:45:38 -0500 Subject: [PATCH] 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. --- remount.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 remount.yml diff --git a/remount.yml b/remount.yml new file mode 100644 index 0000000..74d3539 --- /dev/null +++ b/remount.yml @@ -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 + }}