bundles/icinga2: more auto-generation of stuff

This commit is contained in:
Franzi 2023-09-09 13:55:16 +02:00
parent 7df6b1d13a
commit d1bb94fd74
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 35 additions and 35 deletions

View file

@ -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',
},
},
}

View file

@ -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,
},
},
},
}