diff --git a/roles/gitlab/tasks/main.yaml b/roles/gitlab/tasks/main.yaml
index 9c0d656..5966bb9 100644
--- a/roles/gitlab/tasks/main.yaml
+++ b/roles/gitlab/tasks/main.yaml
@@ -109,8 +109,8 @@
monitoring_entry: >
{{ monitoring_entry | default({}) | combine({
'address': ansible_host,
- 'vhosts_uri': { gitlab_nginx_main_fqdn: {'/': 'Sign in · GitLab'},
- gitlab_nginx_mattermost_fqdn: { '/': '
Mattermost' } },
+ 'vhosts_uri': { gitlab_nginx_main_fqdn: {'/': { 'content': 'Sign in · GitLab'} },
+ gitlab_nginx_mattermost_fqdn: { '/': { 'content': 'Mattermost' } } },
}, recursive=true) }}
- name: 'MONITORING | update monitoring facts'
set_fact:
diff --git a/roles/icinga2-monitoring/templates/host.conf.j2 b/roles/icinga2-monitoring/templates/host.conf.j2
index 67701c9..3335ee3 100644
--- a/roles/icinga2-monitoring/templates/host.conf.j2
+++ b/roles/icinga2-monitoring/templates/host.conf.j2
@@ -10,8 +10,14 @@ object Host "{{ item.key }}" {
vars.agent_type = "ssh"
{% endif %}
+ vars.host_type = "{{ item.value.host_type | d('physical') }}"
+
+{% for var in item.value.vars|d({})|dict2items %}
+ vars.{{ var.key }} = "{{ var.value }}"
+{% endfor %}
+
{% if 'vhosts' in item.value %}
-{% for vhost in item.value.vhosts %}
+{% for vhost in item.value.vhosts %}
vars.http_vhosts["https cert: {{ vhost }}"] = {
http_ssl = true
http_vhost = "{{ vhost }}"
@@ -20,17 +26,17 @@ object Host "{{ item.key }}" {
/* Check remaining days before cert expiration */
http_certificate = "30,20"
}
-{% for uri, content in (item.value.vhosts_uri[vhost]|d({'/': ''})).items() %}
+{% for uri, prop in (item.value.vhosts_uri[vhost]|d({'/': {}})).items() %}
vars.http_vhosts["https service: {{ vhost }}{{ uri }}"] = {
http_ssl = true
http_vhost = "{{ vhost }}"
- http_onredirect = "sticky"
+ http_onredirect = "{{ prop.onredirect|d('sticky') }}"
http_sni = true
http_uri = "{{ uri }}"
- {% if content != '' %}http_string = "{{ content|replace('"','\\"') }}"{% endif %}
+ {% if prop.content|d('') != '' %}http_string = "{{ prop.content|replace('"','\\"') }}"{% endif %}
}
-{% endfor %}
-{% endfor %}
+{% endfor %}
+{% endfor %}
{% endif %}
}
diff --git a/roles/icinga2/tasks/main.yaml b/roles/icinga2/tasks/main.yaml
index 8044693..3129477 100644
--- a/roles/icinga2/tasks/main.yaml
+++ b/roles/icinga2/tasks/main.yaml
@@ -253,4 +253,25 @@
dest: "/etc/nginx/locations/{{ icingaweb2_nginx_fqdn }}/service.conf"
notify:
- 'reload nginx'
+
+- name: 'MONITORING | add HTTP service'
+ block:
+ - name: 'MONITORING | add service to monitoring entry'
+ set_fact:
+ monitoring_entry: >
+ {{ monitoring_entry | default({}) | combine({
+ 'address': ansible_host,
+ 'vhosts_uri': { icingaweb2_nginx_fqdn: {'/icingaweb2': { 'onredirect': 'ok' }} },
+ }, recursive=true) }}
+ - name: 'MONITORING | update monitoring facts'
+ set_fact:
+ monitoring_facts: >
+ {{ hostvars[monitoring_host]['monitoring_facts']
+ | default({})
+ | combine({host_fqdn: monitoring_entry}) }}
+ delegate_facts: true
+ delegate_to: '{{ monitoring_host }}'
+ tags:
+ - 'monitoring'
+
...
diff --git a/roles/lxc_guest/tasks/main.yaml b/roles/lxc_guest/tasks/main.yaml
index dab6dad..cae5946 100644
--- a/roles/lxc_guest/tasks/main.yaml
+++ b/roles/lxc_guest/tasks/main.yaml
@@ -162,14 +162,15 @@
block:
- name: 'MONITORING | add to monitored hosts'
set_fact:
- lxc_monitoring_entry: >
- {{ { host_fqdn: { 'address': ansible_host } } }}
+ monitoring_entry: >
+ {{ { 'address': ansible_host,
+ 'host_type': 'lxc_vm' } }}
- name: 'MONITORING | update monitoring facts'
set_fact:
monitoring_facts: >
{{ hostvars[monitoring_host]['monitoring_facts']
| default({})
- | combine(lxc_monitoring_entry) }}
+ | combine({host_fqdn: monitoring_entry}) }}
delegate_facts: true
delegate_to: '{{ monitoring_host }}'
tags:
diff --git a/roles/monitoring-agent/defaults/main.yaml b/roles/monitoring-agent/defaults/main.yaml
index f1dc259..db7dead 100644
--- a/roles/monitoring-agent/defaults/main.yaml
+++ b/roles/monitoring-agent/defaults/main.yaml
@@ -1,3 +1,4 @@
---
host_fqdn: '{{ ansible_hostname }}.dmz.{{ domain }}'
+monitoring_agent_ssh_mode: true
...
diff --git a/roles/monitoring-agent/tasks/main.yaml b/roles/monitoring-agent/tasks/main.yaml
index d355e17..6d62563 100644
--- a/roles/monitoring-agent/tasks/main.yaml
+++ b/roles/monitoring-agent/tasks/main.yaml
@@ -8,6 +8,12 @@
tags:
- 'packages'
+- name: 'add monitoring plugin - check_mem.pl'
+ copy:
+ src: 'check_mem.pl'
+ dest: '/usr/lib/nagios/plugins/check_mem.pl'
+ mode: '0755'
+
- name: 'create monitoring user'
user:
name: 'icinga'
diff --git a/roles/nextcloud/tasks/main.yaml b/roles/nextcloud/tasks/main.yaml
index 090b2e3..e39e6b7 100644
--- a/roles/nextcloud/tasks/main.yaml
+++ b/roles/nextcloud/tasks/main.yaml
@@ -257,7 +257,7 @@
monitoring_entry: >
{{ monitoring_entry | default({}) | combine({
'address': ansible_host,
- 'vhosts_uri': { nextcloud_nginx_fqdn: {'/': 'nextcloud.com'} },
+ 'vhosts_uri': { nextcloud_nginx_fqdn: {'/': { 'content': 'nextcloud.com'}} },
}, recursive=true) }}
- name: 'MONITORING | update monitoring facts'
set_fact: