ansible-roles/redis/tasks/nrpe.yml

74 lines
1.9 KiB
YAML

---
- 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
when:
- ansible_distribution == "Debian"
- ansible_distribution_major_version | version_compare('9', '<')
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"
- ansible_distribution_major_version | version_compare('9', '<')
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"
- ansible_distribution_major_version | version_compare('9', '>=')
tags:
- redis
- nrpe
- name: Use check_redis for NRPE
replace:
dest: /etc/nagios/nrpe.d/evolix.cfg
regexp: '^command\[check_redis\]=.+'
replace: 'command[check_redis]=sudo {{ redis_check_redis_path }} -H {{ redis_bind_interface }} -p {{ redis_port }}'
when: redis_instance_name is undefined
notify: restart nagios-nrpe-server
tags:
- redis
- nrpe
- name: install check_redis_instances
copy:
src: check_redis_instances.sh
dest: /usr/local/lib/nagios/plugins/check_redis_instances
force: yes
when: redis_instance_name is defined
tags:
- redis
- nrpe
- name: Use check_redis_instances for NRPE
replace:
dest: /etc/nagios/nrpe.d/evolix.cfg
regexp: '^command\[check_redis\]=.+'
replace: 'command[check_redis]=sudo /usr/local/lib/nagios/plugins/check_redis_instances'
when: redis_instance_name is defined
notify: restart nagios-nrpe-server
tags:
- redis
- nrpe