add nrpe role

This commit is contained in:
Pi
2019-03-07 15:39:37 -05:00
parent b149cb3cd2
commit 88a36c542d
5 changed files with 774 additions and 0 deletions

38
roles/nrpe/tasks/main.yaml Executable file
View File

@@ -0,0 +1,38 @@
---
- name: Install nrpe and plugins
become: true
apt:
name: "{{ packages }}"
vars:
packages:
- nagios-nrpe-server
- monitoring-plugins
tags: install_nrpe
- name: Copy configuration files
become: true
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: a+x
with_items:
- { src: "{{ role_path }}/files/nrpe.cfg", dest: "/etc/nagios" }
- { src: "{{ role_path }}/files/nrpe_local.cfg", dest: "/etc/nagios" }
- { src: "{{ role_path }}/files/check_mem.pl", dest: "/usr/lib/nagios/plugins" }
tags: configure_nrpe
- name: enable nrpe
become: true
systemd:
name: nagios-nrpe-server
enabled: yes
masked: no
state: restarted
tags: enable_nrpe
- lineinfile:
path: "/etc/sudoers"
state: present
line: "nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/"
validate: "/usr/sbin/visudo -cf %s"
become: true
tags: nagios_sudo