From d3de7a27be950f54e4917e713f4a473af344e9ac Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 21 Nov 2020 08:57:46 +0100 Subject: [PATCH] bundles/icinga2: add dependencies for icingaweb2 setup --- bundles/icinga2/items.py | 17 ++++++++++++++++- bundles/icinga2/metadata.py | 6 ++++++ data/nginx/files/extras/ovh.icinga2/icingaweb | 4 ++++ nodes/ovh/icinga2.py | 9 +++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/bundles/icinga2/items.py b/bundles/icinga2/items.py index 0ee25f2..a085c0b 100644 --- a/bundles/icinga2/items.py +++ b/bundles/icinga2/items.py @@ -3,6 +3,16 @@ assert node.has_bundle('sshmon') from os.path import join +directories = { + '/etc/icingaweb2': { + 'group': 'icingaweb2', + 'mode': '0775', + 'needs': { + 'pkg_apt:icingaweb2', + }, + }, +} + files = { '/usr/local/share/icinga/plugins/check_rbl': { 'mode': '0755', @@ -18,5 +28,10 @@ files = { 'needs': { 'pkg_apt:icinga2-ido-pgsql', }, - } + }, + '/etc/icingaweb2/setup.token': { + 'content': node.metadata['icingaweb2']['setup-token'], + 'mode': '0660', + 'group': 'icingaweb2', + }, } diff --git a/bundles/icinga2/metadata.py b/bundles/icinga2/metadata.py index d51f927..aee752c 100644 --- a/bundles/icinga2/metadata.py +++ b/bundles/icinga2/metadata.py @@ -22,6 +22,9 @@ defaults = { 'libreadonly-perl': {}, } }, + 'icingaweb2': { + 'setup-token': repo.vault.password_for(f'{node.name} icingaweb2 setup-token'), + }, 'postgresql': { 'roles': { 'icinga2': { @@ -29,6 +32,9 @@ defaults = { }, }, 'databases': { + 'icingaweb2': { + 'owner': 'icinga2', + }, 'icinga2': { 'owner': 'icinga2', }, diff --git a/data/nginx/files/extras/ovh.icinga2/icingaweb b/data/nginx/files/extras/ovh.icinga2/icingaweb index 2b0327d..b83e0ea 100644 --- a/data/nginx/files/extras/ovh.icinga2/icingaweb +++ b/data/nginx/files/extras/ovh.icinga2/icingaweb @@ -6,6 +6,10 @@ fastcgi_param ICINGAWEB_CONFIGDIR /etc/icingaweb2; } + location = / { + return 301 https://$host/authentication/login; + } + location / { try_files $1 $uri $uri/ /index.php$is_args$args; } diff --git a/nodes/ovh/icinga2.py b/nodes/ovh/icinga2.py index 7ebdb2e..5bfba21 100644 --- a/nodes/ovh/icinga2.py +++ b/nodes/ovh/icinga2.py @@ -19,6 +19,11 @@ nodes['ovh.icinga2'] = { 'gateway6': '2001:41d0:701:1100::1' }, }, + 'apt': { + 'packages': { + 'php-imagick': {}, + }, + }, 'nginx': { 'vhosts': { 'icingaweb': { @@ -31,7 +36,11 @@ nodes['ovh.icinga2'] = { 'php': { 'version': '7.4', 'packages': { + 'curl', + 'gd', + 'intl', 'json', + 'ldap', 'opcache', 'pgsql', 'readline',