From 53b7f9791168915ea6aedb9a906f3a49e83b71c6 Mon Sep 17 00:00:00 2001 From: jabertwo <git@jabertwo.de> Date: Sat, 10 Feb 2024 22:32:04 +0100 Subject: [PATCH] fixed icinga test deployment --- group_vars/test | 9 +- site.yml | 2 - testserver/docker_icinga/tasks/main.yml | 5 +- .../templates/etc/icinga/conf.d/hosts.conf | 6 +- .../etc/icinga/conf.d/hosts_manual.conf | 83 ------------------- .../etc/icinga/conf.d/services_backup.conf | 2 +- .../etc/icinga/conf.d/services_container.conf | 2 +- .../etc/icinga/conf.d/services_domains.conf | 2 +- .../etc/icinga/conf.d/services_exporters.conf | 2 +- .../etc/icinga/conf.d/services_system.conf | 2 +- 10 files changed, 16 insertions(+), 99 deletions(-) delete mode 100644 testserver/docker_icinga/templates/etc/icinga/conf.d/hosts_manual.conf diff --git a/group_vars/test b/group_vars/test index fe91cb64..13266484 100644 --- a/group_vars/test +++ b/group_vars/test @@ -42,4 +42,11 @@ oauth_global: token_url: https://uffd.test-warpzone.de/oauth2/token userinfo_url: https://uffd.test-warpzone.de/oauth2/userinfo logout_url: https://uffd.test-warpzone.de/logout - metrics_url: https://uffd.test-warpzone.de/metrics \ No newline at end of file + metrics_url: https://uffd.test-warpzone.de/metrics + +# Matrix Settings +matrix: + domain: matrix.warpzone.ms + public_url: https://matrix.warpzone.ms + identity_server: https://matrix.warpzone.ms + notifications_room_id: "!QxrpmOPYwofaPFqKMY:matrix.warpzone.ms" \ No newline at end of file diff --git a/site.yml b/site.yml index e56f3768..656163a7 100644 --- a/site.yml +++ b/site.yml @@ -69,7 +69,6 @@ servicename: icinga, basedir: "/srv/{{ servicename }}", domain: "icinga.test-warpzone.de", - groupname: test, api_port: 5665, mysql_port: 33306 } @@ -251,7 +250,6 @@ servicename: icinga, basedir: /srv/icinga, domain: icinga.warpzone.ms, - groupname: prod, api_port: 5665, mysql_port: 33306 } diff --git a/testserver/docker_icinga/tasks/main.yml b/testserver/docker_icinga/tasks/main.yml index 5ff983b5..63db1a4a 100644 --- a/testserver/docker_icinga/tasks/main.yml +++ b/testserver/docker_icinga/tasks/main.yml @@ -9,6 +9,7 @@ - { path: "{{ basedir }}/secrets/icinga_api_pass", length: 8 } - { path: "{{ basedir }}/secrets/mysql_admin_pass", length: 12 } - { path: "{{ basedir }}/secrets/mysql_user_pass", length: 12 } + - { path: "{{ basedir }}/secrets/matrix_notification_access_token", length: -1 } - name: Setup OAuth Client Info @@ -98,7 +99,6 @@ - etc/icinga/conf.d/api-users.conf - etc/icinga/conf.d/commands2.conf - etc/icinga/conf.d/groups.conf - - etc/icinga/conf.d/hosts_manual.conf - etc/icinga/conf.d/hosts.conf # - etc/icinga/conf.d/notifications_pushover.conf - etc/icinga/conf.d/notifications.conf @@ -124,5 +124,4 @@ - name: "start {{ servicename }} docker" community.docker.docker_compose_v2: project_src: "{{ basedir }}" - state: present - build: "{{ dockerconfig.changed }}" + state: present \ No newline at end of file diff --git a/testserver/docker_icinga/templates/etc/icinga/conf.d/hosts.conf b/testserver/docker_icinga/templates/etc/icinga/conf.d/hosts.conf index 897910a3..db49029b 100644 --- a/testserver/docker_icinga/templates/etc/icinga/conf.d/hosts.conf +++ b/testserver/docker_icinga/templates/etc/icinga/conf.d/hosts.conf @@ -1,5 +1,5 @@ -{% for host in groups['{{ groupname }}'] %} +{% for host in groups['test'] %} {% if hostvars[host].alert is defined and hostvars[host].alert %} @@ -16,10 +16,6 @@ object Host "{{ host }}" { vars.ext_ip6 = "{{ hostvars[host].ext_ip6 }}" {% endif %} - {% if host in monitoring.internal_ldap_servers %} - vars.is_ldapserver = "True" - {% endif %} - vars.os = "Linux" vars.prometheus = true } diff --git a/testserver/docker_icinga/templates/etc/icinga/conf.d/hosts_manual.conf b/testserver/docker_icinga/templates/etc/icinga/conf.d/hosts_manual.conf deleted file mode 100644 index d1f7c2a8..00000000 --- a/testserver/docker_icinga/templates/etc/icinga/conf.d/hosts_manual.conf +++ /dev/null @@ -1,83 +0,0 @@ - -object Host "wz-router" { - import "generic-host" - - address = "192.168.0.1" - - groups = [ "network" ] -} - -object Host "wz-sw-core" { - import "generic-host" - - address = "192.168.0.2" - - groups = [ "network" ] -} - -object Host "wz-sw-access" { - import "generic-host" - - address = "192.168.0.3" - - # Keine Notifications, da der Switch aus ist wenn die Zone geschlossen ist - vars.enable_nofitications = false - - groups = [ "network" ] -} - -object Host "wz-sw-dach" { - import "generic-host" - - address = "192.168.0.4" - - groups = [ "network" ] -} - -object Host "wz-ap-dach" { - import "generic-host" - - address = "192.168.0.13" - - groups = [ "network" ] -} - -object Host "wz-ap-eingang" { - import "generic-host" - - address = "192.168.0.14" - - groups = [ "network" ] -} - -object Host "wz-ap-lounge" { - import "generic-host" - - address = "192.168.0.10" - - groups = [ "network" ] -} - -object Host "wz-ap-vortrag" { - import "generic-host" - - address = "192.168.0.12" - - groups = [ "network" ] -} - -object Host "wz-ap-werkstatt" { - import "generic-host" - - address = "192.168.0.11" - - groups = [ "network" ] -} - -object Host "eq3max-cube" { - import "generic-host" - - address = "{{ eq3max.cube_host }}" - - groups = [ "network" ] -} diff --git a/testserver/docker_icinga/templates/etc/icinga/conf.d/services_backup.conf b/testserver/docker_icinga/templates/etc/icinga/conf.d/services_backup.conf index ebca4c1b..56a34371 100644 --- a/testserver/docker_icinga/templates/etc/icinga/conf.d/services_backup.conf +++ b/testserver/docker_icinga/templates/etc/icinga/conf.d/services_backup.conf @@ -1,5 +1,5 @@ -{% for host in groups['{{ groupname }}'] %} +{% for host in groups['test'] %} {% if hostvars[host].borgbackup_repos is defined %} {% for repo in hostvars[host].borgbackup_repos %} diff --git a/testserver/docker_icinga/templates/etc/icinga/conf.d/services_container.conf b/testserver/docker_icinga/templates/etc/icinga/conf.d/services_container.conf index 018b1520..66ccb33e 100644 --- a/testserver/docker_icinga/templates/etc/icinga/conf.d/services_container.conf +++ b/testserver/docker_icinga/templates/etc/icinga/conf.d/services_container.conf @@ -1,5 +1,5 @@ -{% for host in groups['{{ groupname }}'] %} +{% for host in groups['test'] %} {% if hostvars[host].alert is defined and hostvars[host].alert %} {% if hostvars[host].alert.containers is defined %} diff --git a/testserver/docker_icinga/templates/etc/icinga/conf.d/services_domains.conf b/testserver/docker_icinga/templates/etc/icinga/conf.d/services_domains.conf index 3e93a245..e0218e99 100644 --- a/testserver/docker_icinga/templates/etc/icinga/conf.d/services_domains.conf +++ b/testserver/docker_icinga/templates/etc/icinga/conf.d/services_domains.conf @@ -1,5 +1,5 @@ -{% for host in groups['{{ groupname }}'] %} +{% for host in groups['test'] %} {% if hostvars[host].ext_ip4 is defined and hostvars[host].ext_ip6 is defined and hostvars[host].webserver_domains is defined %} {% for domain in hostvars[host].webserver_domains %} diff --git a/testserver/docker_icinga/templates/etc/icinga/conf.d/services_exporters.conf b/testserver/docker_icinga/templates/etc/icinga/conf.d/services_exporters.conf index b0de0314..55ea364e 100644 --- a/testserver/docker_icinga/templates/etc/icinga/conf.d/services_exporters.conf +++ b/testserver/docker_icinga/templates/etc/icinga/conf.d/services_exporters.conf @@ -1,5 +1,5 @@ -{% for host in groups['{{ groupname }}'] %} +{% for host in groups['test'] %} {% if hostvars[host].alert is defined and hostvars[host].alert %} apply Service "node-exporter" { diff --git a/testserver/docker_icinga/templates/etc/icinga/conf.d/services_system.conf b/testserver/docker_icinga/templates/etc/icinga/conf.d/services_system.conf index 0c94052c..01d0ae78 100644 --- a/testserver/docker_icinga/templates/etc/icinga/conf.d/services_system.conf +++ b/testserver/docker_icinga/templates/etc/icinga/conf.d/services_system.conf @@ -1,5 +1,5 @@ -{% for host in groups['{{ groupname }}'] %} +{% for host in groups['test'] %} {% if hostvars[host].alert is defined and hostvars[host].alert %} apply Service "node_metrics" { -- GitLab