From d1bb94fd749b59d63921dd9acd92633d4d684b4e Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 9 Sep 2023 13:55:16 +0200 Subject: [PATCH] bundles/icinga2: more auto-generation of stuff --- bundles/icinga2/items.py | 24 ------------------- bundles/icinga2/metadata.py | 46 ++++++++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/bundles/icinga2/items.py b/bundles/icinga2/items.py index 0732d59..a8d6e3a 100644 --- a/bundles/icinga2/items.py +++ b/bundles/icinga2/items.py @@ -275,23 +275,6 @@ files = { 'mode': '0660', 'group': 'icingaweb2', }, - - # Statusmonitor - '/etc/icinga2/icinga_statusmonitor.py': { - 'triggers': { - 'svc_systemd:icinga_statusmonitor:restart', - }, - }, - '/etc/systemd/system/icinga_statusmonitor.service': { - 'triggers': { - 'action:systemd-reload', - 'svc_systemd:icinga_statusmonitor:restart', - }, - }, -} - -pkg_pip = { - 'easysnmp': {}, # for check_usv_snmp } actions = { @@ -337,13 +320,6 @@ svc_systemd = { 'icinga2': { 'needs': icinga_run_deps, }, - 'icinga_statusmonitor': { - 'needs': { - 'file:/etc/icinga2/icinga_statusmonitor.py', - 'file:/etc/systemd/system/icinga_statusmonitor.service', - 'pkg_apt:python3-flask', - }, - }, } diff --git a/bundles/icinga2/metadata.py b/bundles/icinga2/metadata.py index fcbfd13..1131129 100644 --- a/bundles/icinga2/metadata.py +++ b/bundles/icinga2/metadata.py @@ -17,12 +17,8 @@ defaults = { 'icinga2': {}, 'icinga2-ido-pgsql': {}, 'icingaweb2': {}, - - # apparently no longer needed - #'icingaweb2-module-monitoring': {}, - - # neeeded for statusmonitor - 'python3-flask': {}, + 'icingaweb2-module-monitoring': {}, + 'python3-easysnmp': {}, } }, 'icinga2': { @@ -59,6 +55,21 @@ defaults = { 'icingaweb2': { 'setup-token': repo.vault.password_for(f'{node.name} icingaweb2 setup-token'), }, + 'php': { + 'version': '8.2', + 'packages': { + 'curl', + 'gd', + 'intl', + 'imagick', + 'ldap', + 'mysql', + 'opcache', + 'pgsql', + 'readline', + 'xml', + }, + }, 'postgresql': { 'roles': { 'icinga2': { @@ -105,13 +116,26 @@ def add_users_from_json(metadata): @metadata_reactor.provides( - 'firewall/port_rules/5665', + 'nginx/vhosts/icingaweb2', + 'nginx/vhosts/icinga_statusmonitor', ) -def firewall(metadata): +def nginx(metadata): + if not node.has_bundle('nginx'): + raise DoNotRunAgain + return { - 'firewall': { - 'port_rules': { - '5665': atomic(metadata.get('icinga2/restrict-to', set())), + 'nginx': { + 'vhosts': { + 'icingaweb2': { + 'domain': metadata.get('icinga2/web_domain'), + 'webroot': '/usr/share/icingaweb2/public', + 'locations': { + '/api/': { + 'target': 'https://127.0.0.1:5665/', + }, + }, + 'extras': True, + }, }, }, }