ansible-roles/nagios-nrpe/tasks/main.yml
William Hirigoyen 6ab34517b6
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2781|5|2776|5|:-1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/249//ansiblelint">Evolix » ansible-roles » unstable #249</a>
gitea/ansible-roles/pipeline/head This commit looks good
nagios-nrpe: add a NRPE check-local command with completion
2023-05-12 12:35:49 +02:00

91 lines
2.1 KiB
YAML

---
- 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
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: no
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
when: ansible_distribution_major_version is version('10', '>=')