From 21b7a658ca26bf14d310bfeee6e76c59877303f0 Mon Sep 17 00:00:00 2001 From: Zolfa Date: Sun, 3 May 2020 18:17:08 +0200 Subject: [PATCH] roles/icinga2: config backend ini -> pgsql (IcingaWeb2) Move configuration (user preferences) backend from INI files to a dedicated pgSQL db. --- roles/icinga2/files/icingaweb2/config.ini | 3 ++- roles/icinga2/tasks/main.yaml | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/roles/icinga2/files/icingaweb2/config.ini b/roles/icinga2/files/icingaweb2/config.ini index 5ea96a2..2b046fc 100644 --- a/roles/icinga2/files/icingaweb2/config.ini +++ b/roles/icinga2/files/icingaweb2/config.ini @@ -1,6 +1,7 @@ [global] show_stacktraces = "1" -config_backend = "ini" +config_backend = "db" +config_resource = "icingaweb2-config-pgsql" [logging] log = "syslog" diff --git a/roles/icinga2/tasks/main.yaml b/roles/icinga2/tasks/main.yaml index a5fdfae..e90eff8 100644 --- a/roles/icinga2/tasks/main.yaml +++ b/roles/icinga2/tasks/main.yaml @@ -36,8 +36,13 @@ # ***** IcingaWeb2 ***** - name: 'PGSQL | IcingaWeb2 tunings' block: + - name: 'PGSQL | create IcingaWeb2 user preference DB' + postgresql_db: + name: 'icingaweb2' + register: icingaweb2_db - name: 'PGSQL | create IcingaWeb2 socket authentication user' postgresql_user: + db: 'icingaweb2' name: 'www-data' priv: 'ALL' - name: 'PGSQL | GRANT CONNECT to IDO' @@ -92,6 +97,13 @@ tags: - 'packages' +- name: 'PGSQL | populate IcingaWeb2 user preference DB' + shell: 'cat /usr/share/icingaweb2/etc/schema/pgsql.schema.sql | psql -d icingaweb2' + become: true + become_method: 'su' + become_flags: '-p' + become_user: 'www-data' + when: icingaweb2_db.changed - name: 'LDAP | upload client root ca' copy: