2021-08-15 14:24:35 -05:00
|
|
|
---
|
|
|
|
- name: Gather OS specific variables for nrpe
|
|
|
|
include_vars: "{{ item }}"
|
|
|
|
with_first_found:
|
|
|
|
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version }}.yml"
|
|
|
|
- "{{ ansible_distribution|lower }}.yml"
|
|
|
|
- "{{ ansible_os_family|lower }}.yml"
|
|
|
|
- "main.yml"
|
|
|
|
|
|
|
|
- name: Enable CentOS-PowerTools repository
|
|
|
|
block:
|
|
|
|
|
|
|
|
- name: Enable CentOS-PowerTools repository
|
|
|
|
yum_repository:
|
|
|
|
name: PowerTools
|
|
|
|
file: CentOS-PowerTools
|
|
|
|
description: CentOS-$releasever - PowerTool
|
|
|
|
mirrorlist: http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra
|
|
|
|
enabled: yes
|
|
|
|
gpgcheck: 1
|
|
|
|
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
|
|
|
|
|
|
|
|
when: (ansible_facts['distribution'] == 'CentOS' and ansible_facts['distribution_major_version'] == "8")
|
|
|
|
|
|
|
|
- name: Enable CentOS-EPEL repository
|
|
|
|
block:
|
|
|
|
|
|
|
|
- name: Enable CentOS-EPEL repository
|
|
|
|
package:
|
|
|
|
name: epel-release
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Update yum cache (on Redhat).
|
|
|
|
yum:
|
|
|
|
update_cache: true
|
|
|
|
|
|
|
|
when: (ansible_facts['distribution'] == 'CentOS')
|
|
|
|
|
|
|
|
- name: Install NRPE service
|
|
|
|
package:
|
|
|
|
name: "{{ nrpe_package }}"
|
|
|
|
state: present
|
|
|
|
tags:
|
|
|
|
- packages
|
|
|
|
|
|
|
|
- name: Install NRPE plugins
|
|
|
|
package:
|
|
|
|
name: "{{ nrpe_plugin_packages }}"
|
|
|
|
state: present
|
|
|
|
tags:
|
|
|
|
- packages
|
|
|
|
|
|
|
|
- name: Create nrpe.cfg from template
|
|
|
|
template:
|
|
|
|
src: "nrpe_local.cfg.j2"
|
|
|
|
dest: "{{ nrpe_server_dir }}/nrpe_local.cfg"
|
|
|
|
owner: root
|
2021-08-23 18:36:22 -05:00
|
|
|
group: nagios
|
2021-08-23 18:19:06 -05:00
|
|
|
mode: "0640"
|
2021-08-15 14:24:35 -05:00
|
|
|
notify: restart nrpe service
|
|
|
|
tags:
|
|
|
|
- configuration
|
|
|
|
|
|
|
|
- name: Ensure NRPE server is running
|
|
|
|
service:
|
|
|
|
name: "{{ nrpe_service }}"
|
|
|
|
state: started
|
|
|
|
enabled: true
|