Initial commit
This commit is contained in:
commit
c0dec80308
6 changed files with 489 additions and 0 deletions
56
tasks/main.yml
Normal file
56
tasks/main.yml
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue