Initial commit

This commit is contained in:
nemunaire 2023-03-25 16:31:54 +01:00
commit c0dec80308
6 changed files with 489 additions and 0 deletions

56
tasks/main.yml Normal file
View file

@ -0,0 +1,56 @@
---
- name: install nrpe packages (debian)
apt:
name:
- nagios-nrpe-server
- nagios-nrpe-plugin
state: present
update_cache: yes
when: ansible_distribution == 'Debian'
- name: install nrpe packages (alpine)
apk:
name:
- nagios-plugins-disk
- nagios-plugins-load
- nagios-plugins-ntp
- nagios-plugins-procs
- nagios-plugins-users
- nrpe
state: present
update_cache: yes
when: ansible_distribution == 'Alpine'
- name: configure nrpe
template:
src: nrpe.cfg.j2
dest: /etc/nrpe.cfg
notify:
- reload nrpe
when: ansible_distribution == 'Alpine'
- name: configure nrpe
template:
src: nrpe.cfg.j2
dest: /etc/nagios/nrpe.cfg
notify:
- reload nagios-nrpe-server
when: ansible_distribution == 'Debian'
- name: ensure nrpe is running
service:
name: nrpe
enabled: yes
state: started
when: ansible_distribution == 'Alpine'
tags:
- pkg
- name: register the new host on nagios
template:
src: server.cfg.j2
dest: "/etc/nagios/servers/{{ inventory_hostname_short }}.cfg"
delegate_to: "{{ item }}"
with_items: "{{ groups['nagios_hosts'] }}"
notify:
- restart nagios-server