From 6abfd868db120b956c59c9d525064770b698407f Mon Sep 17 00:00:00 2001 From: mwiegand Date: Mon, 5 Sep 2022 13:49:47 +0200 Subject: [PATCH] icinga: features.d -> features-enabled (compat with debian packages) --- bundles/icinga2/files/icinga2.conf | 2 +- bundles/icinga2/items.py | 87 +++++++++++++++--------------- 2 files changed, 43 insertions(+), 46 deletions(-) diff --git a/bundles/icinga2/files/icinga2.conf b/bundles/icinga2/files/icinga2.conf index 94f2734..4f873a5 100644 --- a/bundles/icinga2/files/icinga2.conf +++ b/bundles/icinga2/files/icinga2.conf @@ -5,6 +5,6 @@ include include include -include "features.d/*.conf" +include "features-enabled/*.conf" include_recursive "conf.d" include "hosts.d/*.conf" diff --git a/bundles/icinga2/items.py b/bundles/icinga2/items.py index 72f48b4..b8d0bab 100644 --- a/bundles/icinga2/items.py +++ b/bundles/icinga2/items.py @@ -28,7 +28,16 @@ directories = { 'svc_systemd:icinga2.service:restart', ], }, - '/etc/icinga2/features.d': { + '/etc/icinga2/features-available': { + 'purge': True, + 'owner': 'nagios', + 'group': 'nagios', + 'mode': '0750', + 'triggers': [ + 'svc_systemd:icinga2.service:restart', + ], + }, + '/etc/icinga2/features-enabled': { 'purge': True, 'owner': 'nagios', 'group': 'nagios', @@ -169,50 +178,6 @@ files = { 'svc_systemd:icinga2.service:restart', ], }, - '/etc/icinga2/features.d/ido-pgsql.conf': { - 'source': 'features/ido-pgsql.conf', - 'content_type': 'mako', - 'owner': 'nagios', - 'group': 'nagios', - 'context': { - 'db_password': node.metadata.get('postgresql/roles/icinga2/password') - }, - 'triggers': [ - 'svc_systemd:icinga2.service:restart', - ], - }, - '/etc/icinga2/features.d/syslog.conf': { - 'source': 'features/syslog.conf', - 'owner': 'nagios', - 'group': 'nagios', - 'triggers': [ - 'svc_systemd:icinga2.service:restart', - ], - }, - '/etc/icinga2/features.d/notification.conf': { - 'source': 'features/notification.conf', - 'owner': 'nagios', - 'group': 'nagios', - 'triggers': [ - 'svc_systemd:icinga2.service:restart', - ], - }, - '/etc/icinga2/features.d/checker.conf': { - 'source': 'features/checker.conf', - 'owner': 'nagios', - 'group': 'nagios', - 'triggers': [ - 'svc_systemd:icinga2.service:restart', - ], - }, - '/etc/icinga2/features.d/api.conf': { - 'source': 'features/api.conf', - 'owner': 'nagios', - 'group': 'nagios', - 'triggers': [ - 'svc_systemd:icinga2.service:restart', - ], - }, '/var/lib/icinga2/certs/ca.crt': { 'content_type': 'download', 'source': f'https://letsencrypt.org/certs/isrg-root-x1-cross-signed.pem', @@ -227,6 +192,38 @@ files = { }, } +# FEATURES + +for feature, context in { + 'syslog': {}, + 'notification': {}, + 'checker': {}, + 'api': {}, + 'ido-pgsql': { + 'db_password': node.metadata.get('postgresql/roles/icinga2/password'), + }, +}.items(): + files[f'/etc/icinga2/features-available/{feature}.conf'] = { + 'content_type': 'mako' if context else 'text', + 'context': context, + 'source': f'features/{feature}.conf', + 'owner': 'nagios', + 'group': 'nagios', + 'triggers': [ + 'svc_systemd:icinga2.service:restart', + ], + } + symlinks[f'/etc/icinga2/features-enabled/{feature}.conf'] = { + 'target': f'/etc/icinga2/features-available/{feature}.conf', + 'owner': 'nagios', + 'group': 'nagios', + 'triggers': [ + 'svc_systemd:icinga2.service:restart', + ], + } + +# HOSTS + for other_node in repo.nodes: if other_node.dummy: continue