2019-09-06 13:55:12 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Install perl lib-redis (needed by check_redis)
|
|
|
|
apt:
|
|
|
|
name: libredis-perl
|
|
|
|
state: present
|
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|
|
|
|
|
|
|
|
- name: install check_redis on Jessie
|
|
|
|
copy:
|
|
|
|
src: check_redis.pl
|
|
|
|
dest: /usr/local/lib/nagios/plugins/check_redis
|
|
|
|
force: yes
|
2019-09-06 14:00:44 +02:00
|
|
|
mode: "0755"
|
|
|
|
owner: root
|
|
|
|
group: root
|
2019-09-06 13:55:12 +02:00
|
|
|
when:
|
|
|
|
- ansible_distribution == "Debian"
|
2020-02-25 10:45:35 +01:00
|
|
|
- ansible_distribution_major_version is version('9', '<')
|
2019-09-06 13:55:12 +02:00
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|
|
|
|
|
|
|
|
- name: set the path of check_redis on Jessie
|
|
|
|
set_fact:
|
|
|
|
redis_check_redis_path: /usr/local/lib/nagios/plugins/check_redis
|
|
|
|
when:
|
|
|
|
- ansible_distribution == "Debian"
|
2020-02-25 10:45:35 +01:00
|
|
|
- ansible_distribution_major_version is version('9', '<')
|
2019-09-06 13:55:12 +02:00
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|
|
|
|
|
|
|
|
- name: set the path of check_redis on Stretch and later
|
|
|
|
set_fact:
|
|
|
|
redis_check_redis_path: /usr/lib/nagios/plugins/check_redis
|
|
|
|
when:
|
|
|
|
- ansible_distribution == "Debian"
|
2020-02-25 10:45:35 +01:00
|
|
|
- ansible_distribution_major_version is version('9', '>=')
|
2019-09-06 13:55:12 +02:00
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|
|
|
|
|
2019-09-06 15:55:35 +02:00
|
|
|
- name: sudo without password for nagios
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/sudoers.d/evolinux
|
|
|
|
regexp: 'check_redis$'
|
|
|
|
line: 'nagios ALL = NOPASSWD: {{ redis_check_redis_path }}'
|
|
|
|
insertafter: '^nagios'
|
|
|
|
validate: "visudo -cf %s"
|
2020-06-02 10:54:48 +02:00
|
|
|
create: yes
|
2019-09-06 15:55:35 +02:00
|
|
|
when: redis_instance_name is defined
|
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|
|
|
|
|
2019-09-06 13:55:12 +02:00
|
|
|
- name: Use check_redis for NRPE
|
|
|
|
replace:
|
|
|
|
dest: /etc/nagios/nrpe.d/evolix.cfg
|
|
|
|
regexp: '^command\[check_redis\]=.+'
|
2019-09-06 16:02:00 +02:00
|
|
|
replace: 'command[check_redis]=sudo {{ redis_check_redis_path }} -H {{ redis_bind_interface }} -p {{ redis_port }}'
|
2019-09-06 13:55:12 +02:00
|
|
|
when: redis_instance_name is undefined
|
|
|
|
notify: restart nagios-nrpe-server
|
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|
|
|
|
|
2019-12-13 09:50:59 +01:00
|
|
|
- name: sudo without password for nagios
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/sudoers.d/evolinux
|
|
|
|
regexp: 'check_redis$'
|
|
|
|
line: 'nagios ALL = NOPASSWD: {{ redis_check_redis_path }}'
|
|
|
|
insertafter: '^nagios'
|
|
|
|
validate: "visudo -cf %s"
|
|
|
|
when: redis_instance_name is undefined
|
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|
|
|
|
|
2022-03-23 13:55:54 +01:00
|
|
|
- name: "Remount /usr with RW for 'install check_redis instance'"
|
|
|
|
include_role:
|
|
|
|
name: evolix/remount-usr
|
|
|
|
|
2019-09-06 13:55:12 +02:00
|
|
|
- name: install check_redis_instances
|
|
|
|
copy:
|
|
|
|
src: check_redis_instances.sh
|
|
|
|
dest: /usr/local/lib/nagios/plugins/check_redis_instances
|
|
|
|
force: yes
|
2019-09-06 14:00:44 +02:00
|
|
|
mode: "0755"
|
|
|
|
owner: root
|
|
|
|
group: root
|
2019-09-06 13:55:12 +02:00
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|
|
|
|
|
|
|
|
- name: Use check_redis_instances for NRPE
|
|
|
|
replace:
|
|
|
|
dest: /etc/nagios/nrpe.d/evolix.cfg
|
|
|
|
regexp: '^command\[check_redis\]=.+'
|
2019-09-06 16:02:00 +02:00
|
|
|
replace: 'command[check_redis]=sudo /usr/local/lib/nagios/plugins/check_redis_instances'
|
2019-09-06 13:55:12 +02:00
|
|
|
when: redis_instance_name is defined
|
|
|
|
notify: restart nagios-nrpe-server
|
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|
2019-09-06 15:55:35 +02:00
|
|
|
|
|
|
|
- name: sudo without password for nagios
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/sudoers.d/evolinux
|
|
|
|
regexp: 'check_redis_instances$'
|
|
|
|
line: 'nagios ALL = NOPASSWD: /usr/local/lib/nagios/plugins/check_redis_instances'
|
|
|
|
insertafter: '^nagios'
|
|
|
|
validate: "visudo -cf %s"
|
|
|
|
when: redis_instance_name is defined
|
|
|
|
tags:
|
|
|
|
- redis
|
|
|
|
- nrpe
|