From da3cafca4822f7a098951acafb61ad30ee88a310 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Tue, 23 May 2017 15:10:58 +0200 Subject: [PATCH] evocheck: remount /usr if needed --- evocheck/tasks/main.yml | 4 ++++ evocheck/tasks/remount_usr_rw.yml | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 evocheck/tasks/remount_usr_rw.yml diff --git a/evocheck/tasks/main.yml b/evocheck/tasks/main.yml index 415b7420..664b7c00 100644 --- a/evocheck/tasks/main.yml +++ b/evocheck/tasks/main.yml @@ -1,4 +1,8 @@ --- + +- include: remount_usr_rw.yml + when: evocheck_bin_dir | search ("/usr") + - name: Scripts dir is present file: path: "{{ evocheck_bin_dir }}" diff --git a/evocheck/tasks/remount_usr_rw.yml b/evocheck/tasks/remount_usr_rw.yml new file mode 100644 index 00000000..a62d86d6 --- /dev/null +++ b/evocheck/tasks/remount_usr_rw.yml @@ -0,0 +1,13 @@ +--- +- name: Get mount options for partitions + shell: "mount | grep 'on /usr type'" + args: + warn: no + register: mount + changed_when: False + failed_when: False + when: not ansible_check_mode + +- name: Remount /usr if it is a partition and it is not mounted in rw + command: "mount -o remount,rw /usr" + when: mount.rc == 0 and not mount.stdout_lines.0 | search("rw")