-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.yml
107 lines (100 loc) · 3.23 KB
/
site.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
- hosts: all
become: true
gather_facts: False
pre_tasks:
- name: Install python for Ansible
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
register: output
changed_when: output.stdout != ""
- hosts: monitoring_servers
gather_facts: true
become: true
roles:
- role: mysql
- role: apache
- role: goozbach.EPEL
- role: icinga2-ansible-no-ui
icinga2_conf_global: |
include "constants.conf"
include "zones.conf"
include <itl>
include <plugins>
include "features-enabled/*.conf"
include_recursive "conf.d"
check_commands:
check_nrpe: |
"-H", "$address$",
"-c", "$remote_nrpe_command$",
tags: icinga2-no-ui
# - role: icinga2-ansible-classic-ui
# icinga2_classic_ui_passwd: 'demo'
# tags: icinga2-classic-ui
- role: icinga2-ansible-web2-ui
icinga2_db_pass: "CHANGEME"
icinga2_web2_db_pass: "CHANGEME"
icinga2_ido_mysql_configuration: |
library "db_ido_mysql"
object IdoMysqlConnection "ido-mysql" {
user = "{{ icinga2_db_user }}"
password = "{{ icinga2_db_pass }}"
host = "localhost"
database = "{{ icinga2_db }}"
}
tags: icinga2-ansible-web2-ui
- hosts: all
gather_facts: true
- hosts: monitoring_servers
gather_facts: true
become: true
roles:
- role: icinga2-ansible-add-hosts
configuration_logic: "object"
host_attributes: |
check_command = "http"
vars.sla = "24x7"
host_checks: |
object Service "load_average" {
check_command = "nrpe"
host_name = "{{ hostvars[item]['ansible_fqdn'] }}"
vars.nrpe_command = "check_load"
}
object Service "disk" {
host_name = "{{ hostvars[item]['ansible_fqdn'] }}"
check_command = "nrpe"
vars.nrpe_command = "check_disk"
}
object Service "logged users" {
host_name = "{{ hostvars[item]['ansible_fqdn'] }}"
check_command = "nrpe"
vars.nrpe_command = "check_users"
}
object Service "Running procs" {
host_name = "{{ hostvars[item]['ansible_fqdn'] }}"
check_command = "nrpe"
vars.nrpe_command = "check_procs"
}
tags: add-hosts
- hosts: webservers
gather_facts: true
become: true
roles:
- role: apache
- role: goozbach.EPEL
- role: icinga2-nrpe-agent
nrpe_allowed_hosts: ",127.0.0.1"
nrpe_configuration: |
log_facility=daemon
server_port=5666
server_address={{ ansible_default_ipv4.address }}
dont_blame_nrpe=0
debug=0
command_timeout=60
connection_timeout=150
nrpe_check_commands: |
command[check_load]={{ nrpe_agent_plugins_x86_64 }}/check_load -w 15,10,8 -c 30,25,15
command[check_ssh]={{ nrpe_agent_plugins_x86_64 }}/check_ssh -H {{ ansible_eth0.ipv4.address }} -p {{ ansible_port }}
command[check_procs]={{ nrpe_agent_plugins_x86_64 }}/check_procs -w 300 -c 500
command[check_disk]={{ nrpe_agent_plugins_x86_64 }}/check_disk -w 15% -c 10% -p / -p /home -p /tmp
command[check_users]={{ nrpe_agent_plugins_x86_64 }}/check_users -w 5 -c 8
tags: nrpe-agent