diff --git a/drbd-utils/tasks/nagios.yml b/drbd-utils/tasks/nagios.yml index 10316dac..fb2c9409 100644 --- a/drbd-utils/tasks/nagios.yml +++ b/drbd-utils/tasks/nagios.yml @@ -5,10 +5,20 @@ path: /usr/local/lib/nagios/plugins/ register: nagios_plugins_dir -- name: Mount /usr in rw - command: mount -o remount,rw /usr warn=no +- name: Check if /usr is a partition + shell: "mount | grep 'on /usr type'" + args: + warn: no changed_when: False - when: nagios_plugins_dir.stat.exists + failed_when: False + register: usr_partition + +- name: Mount /usr in rw + command: mount -o remount,rw /usr + args: + warn: no + changed_when: False + when: usr_partition.rc == 0 and nagios_plugins_dir.stat.exists # https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=3367&cf_id=30 - name: Install Nagios plugin diff --git a/evoacme/tasks/certbot.yml b/evoacme/tasks/certbot.yml index 2d7589c0..10bbfb47 100644 --- a/evoacme/tasks/certbot.yml +++ b/evoacme/tasks/certbot.yml @@ -39,9 +39,20 @@ state: latest default_release: "{{ evoacme_certbot_release }}" - - name: Mount /usr in rw - command: mount -o remount,rw /usr warn=no + - name: Check if /usr is a partition + shell: "mount | grep 'on /usr type'" + args: + warn: no changed_when: False + failed_when: False + register: usr_partition + + - name: Mount /usr in rw + command: mount -o remount,rw /usr + args: + warn: no + changed_when: False + when: usr_partition.rc == 0 - name: Remove certbot symlink for apt install file: diff --git a/filebeat/tasks/main.yml b/filebeat/tasks/main.yml index 352ac051..4fc55568 100644 --- a/filebeat/tasks/main.yml +++ b/filebeat/tasks/main.yml @@ -30,12 +30,27 @@ when: filebeat_logstash_plugin and logstash_plugin.stat.exists - block: - - name: /usr is mounted as "rw" - command: mount -oremount,rw /usr + - name: Check if /usr is a partition + shell: "mount | grep 'on /usr type'" + args: + warn: no + changed_when: False + failed_when: False + register: usr_partition + + - name: Mount /usr in rw + command: mount -o remount,rw /usr + args: + warn: no + changed_when: False + when: usr_partition.rc == 0 - name: Logstash plugin is installed command: /usr/share/logstash/bin/logstash-plugin install logstash-input-beats - name: /usr is remounted command: mount -oremount /usr - when: filebeat_logstash_plugin and logstash_plugin.stat.exists and not logstash_plugin_installed | success + args: + warn: no + changed_when: False + when: usr_partition.rc == 0 and filebeat_logstash_plugin and logstash_plugin.stat.exists and not logstash_plugin_installed | success diff --git a/kvm-host/tasks/main.yml b/kvm-host/tasks/main.yml index 92be3d72..4a70dfa1 100644 --- a/kvm-host/tasks/main.yml +++ b/kvm-host/tasks/main.yml @@ -1,8 +1,19 @@ --- - include: packages.yml -- name: Mount /usr in rw - command: mount -o remount,rw /usr warn=no +- name: Check if /usr is a partition + shell: "mount | grep 'on /usr type'" + args: + warn: no changed_when: False + failed_when: False + register: usr_partition + +- name: Mount /usr in rw + command: mount -o remount,rw /usr + args: + warn: no + changed_when: False + when: usr_partition.rc == 0 - include: munin.yml diff --git a/tomcat-instance/tasks/nagios.yml b/tomcat-instance/tasks/nagios.yml index 805e4e77..18d58b6f 100644 --- a/tomcat-instance/tasks/nagios.yml +++ b/tomcat-instance/tasks/nagios.yml @@ -1,12 +1,23 @@ --- -- name: Intall monitorings plugins +- name: Intall monitorings plugins apt: name: monitoring-plugins state: present -- name: Mount /usr in rw - command: mount -o remount,rw /usr warn=no +- name: Check if /usr is a partition + shell: "mount | grep 'on /usr type'" + args: + warn: no changed_when: False + failed_when: False + register: usr_partition + +- name: Mount /usr in rw + command: mount -o remount,rw /usr + args: + warn: no + changed_when: False + when: usr_partition.rc == 0 - name: Create Nagios plugins dir file: