2015-05-28 11:32:57 +02:00
---
- name : Install the nagios packages
2018-01-15 18:44:28 +01:00
apt : pkg={{ item }} state=installed update_cache=yes cache_valid_time=1800
2016-03-15 20:25:54 +01:00
with_items : '{{ nagios_plugins_base_pkgs }}'
2015-07-15 13:53:12 +02:00
tags : nagios
2015-05-28 11:32:57 +02:00
2016-03-31 13:41:38 +02:00
- name : Additional nagios plugins when available
2018-01-15 18:44:28 +01:00
apt : pkg={{ item }} state=installed update_cache=yes cache_valid_time=1800
2016-03-15 20:25:54 +01:00
with_items : '{{ nagios_plugins_contrib }}'
2016-02-10 13:41:07 +01:00
tags : [ 'nagios' , 'nagios_plug_contrib' ]
2015-05-28 11:32:57 +02:00
- name : Create the directory where our local plugins are installed
file : path={{ nagios_isti_plugdir }} state=directory
2015-07-15 13:53:12 +02:00
tags : nagios
2015-05-28 11:32:57 +02:00
- name : Install the generic shell library used by some custom checks
template : src=check_library.sh.j2 dest={{ nagios_isti_plugdir }}/check_library.sh owner=root group=root mode=0644
2015-07-15 13:53:12 +02:00
tags : nagios
2015-05-28 11:32:57 +02:00
- name : Install plugins that can be useful on all the installed servers
copy : src={{ item }} dest={{ nagios_isti_plugdir }}/{{ item }} owner=root group=nagios mode=0755
with_items :
- check_system_pp
- show_users
- check_netint.pl
2015-07-15 13:53:12 +02:00
tags : nagios
2015-05-28 11:32:57 +02:00
- name : Install the global nrpe commands file
template : src=common-nrpe.cfg.j2 dest=/etc/nagios/nrpe.d/common.cfg owner=root group=root mode=444
2015-07-15 13:53:12 +02:00
notify : Reload NRPE server
tags : [ 'nagios' , 'nrpe' , 'nrpe_cfg' ]
2015-05-28 11:32:57 +02:00
- name : set the NRPE ACL
action : |
2015-07-15 13:53:12 +02:00
lineinfile name=/etc/nagios/nrpe.cfg regexp="allowed_hosts=" line="allowed_hosts=127.0.0.1,{% for ip in nagios_monitoring_server_ip %}{{ ip }}{%if not loop.last %},{% endif %}{% endfor %}"
notify : Reload NRPE server
tags : [ 'nagios' , 'nrpe' , 'nrpe_cfg' ]
2015-05-28 11:32:57 +02:00
- name : set the NRPE default timeout
lineinfile : name=/etc/nagios/nrpe.cfg regexp="command_timeout=" line="command_timeout={{ nrpe_command_timeout }}"
2015-07-15 13:53:12 +02:00
notify : Reload NRPE server
tags : [ 'nagios' , 'nrpe' , 'nrpe_cfg' ]
2015-05-28 11:32:57 +02:00
- name : nagios needs root to execute some commands. We do it via sudo
template : src=nagios.sudoers.j2 dest=/etc/sudoers.d/nagios owner=root group=root mode=0440
2015-07-15 13:53:12 +02:00
tags : [ 'nagios' , 'nrpe' , 'sudo' ]
2015-05-28 11:32:57 +02:00