ansible-roles/nagios-nrpe/tasks/main.yml
William Hirigoyen 41ec5b737b
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2635|12|2623|7|:-1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/384//ansiblelint">Evolix » ansible-roles » unstable #384</a>
gitea/ansible-roles/pipeline/head This commit looks good
nagios: rename var into and check systemd-timesyncd instead of ntpd in Debian 12
2023-11-07 17:46:29 +01:00

98 lines
2.4 KiB
YAML

---
- name:
ansible.builtin.set_fact:
nagios_nrpe_processes: "{{ nagios_nrpe_processes_default_before_debian_12 if ansible_distribution_major_version is version('12', '<') else nagios_nrpe_processes_default }}"
when:
nagios_nrpe_processes == None or nagios_nrpe_processes|length <= 0
- name: base nrpe & plugins packages are installed
ansible.builtin.apt:
name:
- nagios-nrpe-server
- monitoring-plugins
- monitoring-plugins-basic
- monitoring-plugins-common
- monitoring-plugins-standard
- nagios-plugins-contrib
state: present
tags:
- nagios-nrpe
- name: custom plugin dependencies packages are installed
ansible.builtin.apt:
name:
- libfcgi-client-perl
- ruby-crack
state: present
when:
- ansible_distribution == "Debian"
- ansible_distribution_major_version is version('10', '>=')
tags:
- nagios-plugins
- name: custom configuration is present
ansible.builtin.template:
src: evolix.cfg.j2
dest: /etc/nagios/nrpe.d/evolix.cfg
group: nagios
mode: "0640"
force: false
notify: restart nagios-nrpe-server
tags:
- nagios-nrpe
- name: update allowed_hosts lists
ansible.builtin.lineinfile:
dest: /etc/nagios/nrpe.d/evolix.cfg
line: "allowed_hosts={{ nagios_nrpe_allowed_hosts | join(',') }}"
regexp: '^allowed_hosts='
insertafter: '# Allowed IPs'
notify: restart nagios-nrpe-server
when: nagios_nrpe_force_update_allowed_hosts | bool
tags:
- nagios-nrpe
- name: Nagios config is secured
ansible.builtin.file:
dest: /etc/nagios/
mode: "0750"
group: nagios
state: directory
notify: restart nagios-nrpe-server
tags:
- nagios-nrpe
- ansible.builtin.include_role:
name: evolix/remount-usr
when: nagios_plugins_directory is search("/usr")
tags:
- nagios-nrpe
- nagios-plugins
- name: Nagios plugins are installed
ansible.builtin.copy:
src: plugins/
dest: "{{ nagios_plugins_directory }}/"
mode: "0755"
notify: restart nagios-nrpe-server
tags:
- nagios-nrpe
- nagios-plugins
- name: Nagios lib is secured
ansible.builtin.file:
dest: /usr/local/lib/nagios/
mode: "0755"
group: nagios
recurse: yes
state: directory
notify: restart nagios-nrpe-server
tags:
- nagios-nrpe
- ansible.builtin.include_tasks: wrapper.yml
- ansible.builtin.include_tasks: check-local.yml