Files
nagios/roles/pips/tasks/nagios_tasks.yml
T
2025-11-21 16:47:10 +01:00

30 lines
762 B
YAML

- name: Gather installed package facts
package_facts:
manager: auto
# nagios-plugins-nrpe.x86_64 , nrpe, nagios-nrpe-plugin
- name: Check OS
debug:
msg: "{{ ansible_facts['os_family'] }} is the OS"
- name: Check if nagios NRPE is installed
debug:
msg: "NRPE is installed."
when: "'nrpe' in ansible_facts.packages"
- name: Ensure NRPE is installed (Debian/Ubuntu)
apt:
name: nrpe
state: present
become: yes
register: nrpe_install_result
when: "'nrpe' not in ansible_facts.packages"
- name: Deploy custom Nagios/NRPE script
ansible.builtin.copy:
src: memory_usage_check.py
dest: /usr/local/nagios/libexec/my_custom_check.py
mode: '0755'
when: nrpe_install_result is defined and nrpe_install_result.changed