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

45 lines
1.6 KiB
YAML
Raw Normal View History

2023-10-23 12:17:20 +00:00
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Install and configure NAGIOS-NRPE
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2024-02-15 16:23:12 +00:00
- name: "[CONFIG NAGIOS NRPE] Comprobando si es necesario configurar nagios nrpe service "
meta: end_host
2024-02-15 17:50:53 +00:00
when: nagios_nrpe_enabled is not defined or not nagios_nrpe_enabled
2024-02-15 16:23:12 +00:00
2023-10-23 12:17:20 +00:00
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 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'
2023-10-23 12:25:47 +00:00
# backup: yes # NO BACKUPS
2023-10-23 12:17:20 +00:00
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# paso3
# create file 99-local.cfg to /etc/nagios/nrpe.d/
- name: create 99-local.cfg to /etc/nagios/nrpe.d/
file:
2023-10-23 12:24:13 +00:00
path: "{{ local_path }}"
2023-10-23 12:17:20 +00:00
state: touch
mode: '0644'
notify: restart nagios-nrpe
2023-10-23 15:17:28 +00:00
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# service should start on boot.
- name: service should start on boot
service:
name: "{{ nagios_nrpe_daemon }}"
enabled: yes
2023-10-23 12:17:20 +00:00
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++