forked from evolix/ansible-roles
Jérémy Lecour
8920ff1ee4
There is also the "check_mode: no", but commented, for when we switch to Ansible 2.2
34 lines
857 B
YAML
34 lines
857 B
YAML
---
|
|
|
|
- name: Check if Nagios is installed
|
|
stat:
|
|
path: /usr/local/lib/nagios/plugins/
|
|
register: nagios_plugins_dir
|
|
#check_mode: no (for migration to Ansible 2.2)
|
|
always_run: yes
|
|
|
|
- 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
|
|
#check_mode: no (for migration to Ansible 2.2)
|
|
always_run: yes
|
|
|
|
- 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
|
|
copy:
|
|
src: "nagios/check_drbd"
|
|
dest: "/usr/local/lib/nagios/plugins/check_drbd"
|
|
mode: "755"
|
|
when: nagios_plugins_dir.stat.exists
|