Unverified Commit ff23c987 authored by aflatto's avatar aflatto Committed by GitHub

Fixing several small bugs (#77)

* Fix nrpe configuration - allowed hosts IP detection
parent 8bb6ac8c
---
# 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
......@@ -5,23 +5,23 @@ icinga2_classic_ui_passwd: "none"
# Vars for Debian OS Family
icinga2_classic_ui_pkg:
- { package: "icinga2-classicui" }
- { package: "python-passlib" }
- icinga2-classicui
- python-passlib
htpasswd_deb: "/etc/icinga2/classicui/htpasswd.users"
# Vars for RH OS Family
icinga2_classic_ui_rpm:
- { package: "icinga2-classicui-config" }
- { package: "icinga-gui" }
- { package: "python-passlib" }
- icinga2-classicui-config
- icinga-gui
- python-passlib
htpasswd_rh: "/etc/icinga/passwd"
# Vars for Gentoo OS Family
icinga2_classic_ui_ebuilds:
- { package: "icinga" }
- { package: "passlib" }
- icinga
- passlib
# Set which webserver to use, choice between apache2 and lighttpd, set to none if using
# another webserver, but then you're on your own with configuring the webserver
......
---
- name: Install Icinga Classic UI on Debian OS family
apt: pkg={{ item.package }}
apt: pkg={{ item }}
state=latest
update_cache=yes
cache_valid_time=30
......
......@@ -26,7 +26,7 @@
when: icinga2_classic_ui_gentoo_package_use == 'directory' and icinga2_classic_ui_webserver == 'lighttpd'
- name: Install Icinga Classic UI on Gentoo OS family
portage: package={{ item.package }}
portage: package={{ item }}
state=present
with_items: "{{ icinga2_classic_ui_ebuilds }}"
......
---
- name: Install Icinga Classic UI on RedHat OS family
yum: name={{ item.package }}
yum: name={{ item }}
state=latest
with_items: "{{ icinga2_classic_ui_rpm }}"
notify:
......
......@@ -10,9 +10,9 @@ icinga2_deb_repos:
icinga2_debmon_repo: "deb http://debmon.org/debmon debmon-{{ ansible_distribution_release }} main"
icinga2_pkg:
- { package: "icinga2" }
- { package: "nagios-plugins" }
- { package: "bsd-mailx" }
- icinga2
- nagios-plugins
- bsd-mailx
icinga2_use_public_yum_repo: True
icinga2_url_yum: "https://packages.icinga.org/epel/ICINGA-release.repo"
......@@ -20,10 +20,10 @@ icinga2_url_yum_fedora: "https://packages.icinga.org/fedora/ICINGA-release.repo"
icinga2_repo_yum: "/etc/yum.repos.d/ICINGA-release.repo"
icinga2_yum:
- { package: "icinga2" }
- { package: "icinga2-selinux" }
- { package: "nagios-plugins-all" }
- { package: "mailx" }
- icinga2
- icinga2-selinux
- nagios-plugins-all
- mailx
icinga2_main_conf: "/etc/icinga2/icinga2.conf"
icinga2_conf_d: "/etc/icinga2/conf.d"
......@@ -26,7 +26,7 @@
state=present
- name: Install Icinga2 on Debian OS family
apt: pkg={{ item.package }}
apt: pkg={{ item }}
update_cache=yes
state=latest
install_recommends=no
......
---
- name: Install Icinga2 on Gentoo OS family
portage: package={{ item.package }} state=present
portage: package={{ item }} state=present
with_items: "{{ icinga2_pkg }}"
- name: Start Icinga2
......
......@@ -16,13 +16,13 @@
when: icinga2_use_public_yum_repo
- name: Install Icinga2 on RedHat OS family
yum: name={{ item.package }}
yum: name={{ item }}
state=latest
with_items: "{{ icinga2_yum }}"
when: ansible_pkg_mgr == "yum"
- name: Install Icinga2 on RedHat OS family (Fedora > 22)
dnf: name={{ item.package }}
dnf: name={{ item }}
state=latest
with_items: "{{ icinga2_yum }}"
when: ansible_pkg_mgr == "dnf"
......
......@@ -18,7 +18,7 @@
- name: Install Icinga2 on Debian OS family
apt:
pkg: "{{ item.package }}"
pkg: "{{ item }}"
update_cache: yes
state: latest
install_recommends: no
......
......@@ -4,16 +4,16 @@
# Vars for RH OS Family
icinga2_web_ui_rpm:
- { package: "icinga-web" }
- { package: "icinga-web-{{ icinga2_web_ui_ido }}" }
- icinga-web
- "icinga-web-{{ icinga2_web_ui_ido }}"
icinga2_web_ui_mariadb_rpm:
- { package: "mariadb-server" }
- { package: "MySQL-python" }
- mariadb-server
- MySQL-python
icinga2_web_ui_mysql_rpm:
- { package: "mysql-server" }
- { package: "MySQL-python" }
- mysql-server
- MySQL-python
icinga2_web_db_dbuser: "icinga_web"
......
---
- name: Install IDO {{ icinga2_web_ui_ido }} on RedHat OS family
yum: name=icinga2-ido-{{ icinga2_web_ui_ido }}
yum: name=icinga2-ido-{{ icinga2_web_ui_ido }}
state=latest
- include_tasks: icinga2_web_ui_mysql_RedHat_install.yml
when: icinga2_web_ui_ido == "mysql"
- name: Install Icinga Web on RedHat OS family
yum: name={{ item.package }}
yum: name={{ item }}
state=latest
with_items: "{{ icinga2_web_ui_rpm }}"
......
---
- name: Install MariaDB and Utils on Red Hat OS Family (based on your choice in icinga2_web_ui_ido value)
yum: name={{ item.package }}
yum: name={{ item }}
state=latest
with_items: "{{ icinga2_web_ui_mariadb_rpm }}"
when: ansible_distribution_major_version == "7"
......@@ -12,7 +12,7 @@
when: ansible_distribution_major_version == "7"
- name: Install MySQL and Utils on Red Hat OS Family (based on your choice in icinga2_web_ui_ido value)
yum: name={{ item.package }}
yum: name={{ item }}
state=latest
with_items: icinga2_web_ui_{{ icinga2_web_ui_ido }}_rpm
when: ansible_distribution_major_version == "6"
......
......@@ -18,8 +18,10 @@ icinga2_web2_mysql_schema_debian: "/usr/share/icingaweb2/etc/schema/mysql.schema
enablerepo: "base"
icinga2_web2_ui_rpm:
- { package: "icingaweb2" }
- { package: "icingacli" }
- icingaweb2
- icingacli
- git
icinga2_web2_ui_deb:
- { package: "icingaweb2" }
- icingaweb2
- git
......@@ -68,7 +68,7 @@
- name: Install Icinga Web2 on Debian family
apt:
name: "{{ item.package }}"
name: "{{ item }}"
state: latest
with_items: "{{ icinga2_web2_ui_deb }}"
tags: icinga2-ansible-web2-ui-install
......
......@@ -53,11 +53,6 @@
msg: "please enable subscription-manager repos --enable rhel-server-rhscl-{{ ansible_facts.ansible_distribution_major_version }}-rpms"
when: ansible_distribution == "RedHat"
- debug:
var: ansible_distribution_major_version
verbosity: 2
- name: Install Mysql php-fpm
package:
name: rh-php71-php-mysqlnd
......@@ -92,7 +87,7 @@
- name: Install Icinga Web2 on RedHat OS family
yum: name={{ item.package }}
yum: name={{ item }}
state=latest
enablerepo={{ enablerepo }}
with_items: "{{ icinga2_web2_ui_rpm }}"
......
......@@ -2,17 +2,17 @@
# defaults file for icinga2-nrpe-agent
nrpe_agent_RedHat:
- { package: "nrpe" }
- { package: "nagios-plugins-all" }
- nrpe
- nagios-plugins-all
nrpe_agent_Debian:
- { package: "nagios-nrpe-server" }
- { package: "nagios-nrpe-plugin" }
- { package: "nagios-plugins" }
- nagios-nrpe-server
- nagios-nrpe-plugin
- nagios-plugins
nrpe_agent_Gentoo:
- { package: "nrpe" }
- { package: "nagios-plugins" }
- nrpe
- nagios-plugins
nrpe_agent_config: "/etc/nagios/nrpe.cfg"
......@@ -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.package }}
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:
- nrpe_agent_config
---
- name: Install Nrpe and Plugins
portage: package={{ item.package }}
portage: package={{ item }}
state=present
update=yes
with_items: "{{ nrpe_agent_Gentoo }}"
......
---
- name: Install Nrpe and Plugins
yum: name={{ item.package }}
yum: name={{ item }}
state=latest
with_items: "{{ nrpe_agent_RedHat }}"
when: ansible_pkg_mgr == "yum"
- name: Install Nrpe and Plugins
dnf: name={{ item.package }}
dnf: name={{ item }}
state=latest
with_items: "{{ nrpe_agent_RedHat }}"
when: ansible_pkg_mgr == "dnf"
......
---
# 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