Remount /usr only if it is a dedicated partition

This commit is contained in:
Jérémy Lecour 2017-01-12 16:23:42 +01:00 committed by Jérémy Lecour
parent 095693582a
commit 5a7a561cca
5 changed files with 71 additions and 13 deletions

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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: