vn-ansible/roles/config-nagios-nrpe/tasks/main.yaml

45 lines
1.6 KiB
YAML

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Install and configure NAGIOS-NRPE
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- name: "[CONFIG NAGIOS NRPE] Comprobando si es necesario configurar nagios nrpe service "
meta: end_host
when: nagios_nrpe_enabled is not defined or not nagios_nrpe_enabled
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# paso1
# install packages for nagios-nrpe
- name: install packages for nagios-nrpe (nagios-nrpe-server nagios-nrpe-plugin)
apt:
name: "{{ item }}"
state: present
with_items:
- nagios-nrpe-server
- nagios-nrpe-plugin
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# paso2
# copy file 90-vn.cfg to /etc/nagios/nrpe.d/
- name: copy file 90-vn.cfg to /etc/nagios/nrpe.d/
copy:
src: 90-vn.cfg
dest: /etc/nagios/nrpe.d/90-vn.cfg
owner: root
group: root
mode: '0644'
# backup: yes # NO BACKUPS
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# paso3
# create file 99-local.cfg to /etc/nagios/nrpe.d/
- name: create 99-local.cfg to /etc/nagios/nrpe.d/
file:
path: "{{ local_path }}"
state: touch
mode: '0644'
notify: restart nagios-nrpe
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# service should start on boot.
- name: service should start on boot
service:
name: "{{ nagios_nrpe_daemon }}"
enabled: yes
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++