Commit fd72c7d8 authored by Assaf Flatto's avatar Assaf Flatto

Fix nrpe configuration - allowed hosts IP detection

parent f9d8d51e
---
# defaults file for icinga2-ansible-add-hosts
icinga2_hosts_dir: "/etc/icinga2/conf.d/"
icinga2_hosts_dir: "/etc/icinga2/conf.d/hosts"
host_address: "{{ hostvars[item]['ansible_default_ipv4']['address'] }}"
host_attributes: "none"
host_checks: "none"
---
# tasks file for icinga2-ansible-add-hosts
- name: create Autogenerated host directory
file:
path: "{{ icinga2_hosts_dir }}"
owner: icinga
group: icinga
mode: 0755
state: directory
recurse: yes
- import_tasks: icinga2_add_hosts.yml
......@@ -24,6 +24,8 @@ nrpe_agent_plugins_x86_64: "/usr/lib64/nagios/plugins"
nrpe_agent_check_mem: "https://raw.githubusercontent.com/zwindler/check_mem_ng/master/check_mem_ng.sh"
ssh_port: 22
# Sample NRPE check commands
nrpe_check_commands:
check_load:
......
---
- name: Install Nrpe and Plugins
apt: pkg={{ item }}
state=latest
update_cache=yes
install_recommends=no
package:
name: "{{ item }}"
state: latest
update_cache: yes
install_recommends: no
with_items: "{{ nrpe_agent_Debian }}"
tags:
- nrpe_agent_install
- name: Copy Nrpe Configuration
template: src=nrpe.cfg.j2
dest={{ nrpe_agent_config }}
owner=root
group=root
mode=0644
backup=yes
template:
src: nrpe.cfg.j2
dest: "{{ nrpe_agent_config }}"
owner: root
group: root
mode: 0644
backup: yes
notify:
- restart nagios-nrpe-server
tags:
......
---
# tasks file for icinga2-nrpe-agent
- set_fact:
allowed_hosts: "{{ hostvars[item]['ansible_default_ipv4']['address'] }}"
with_inventory_hostnames: monitoring_servers
- include_tasks: icinga2_nrpe_agent_RedHat.yml
when: ansible_os_family == 'RedHat' and 'monitoring_servers' not in group_names
# NRPE Agent will be installed on clients only
......
# {{ ansible_managed }}
allowed_hosts={{ nrpe_allowed_hosts }}
allowed_hosts={{ allowed_hosts | default('nrpe_allowed_hosts') }}
{{ nrpe_configuration }}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment