From 07a681b4351b7d9e39eb007ba56fe796e15fb6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Fra=C3=9F?= Date: Sat, 23 Dec 2023 12:19:29 +0100 Subject: [PATCH] =?UTF-8?q?[mod]=20role:authelia:Unterst=C3=BCtzung=20f?= =?UTF-8?q?=C3=BCr=20PostgreSQL=20und=20MariaDB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ansible/roles/authelia/defaults/main.json | 13 ++++++++++- .../authelia/templates/conf-main.json.j2 | 23 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ansible/roles/authelia/defaults/main.json b/ansible/roles/authelia/defaults/main.json index d2fbace..8206661 100644 --- a/ansible/roles/authelia/defaults/main.json +++ b/ansible/roles/authelia/defaults/main.json @@ -7,8 +7,19 @@ "var_authelia_log_file_path": "/var/authelia/log.jsonl", "var_authelia_session_domain": "example.org", "var_authelia_session_secret": "REPLACE_ME", - "var_authelia_storage_path": "/var/authelia/state.db", "var_authelia_storage_encryption_key": "storage_encryption_key", + "var_authelia_storage_kind": "sqlite", + "var_authelia_storage_data_sqlite_path": "/var/authelia/state.db", + "var_authelia_storage_data_postgresql_host": "localhost", + "var_authelia_storage_data_postgresql_port": 5432, + "var_authelia_storage_data_postgresql_username": "authelia_user", + "var_authelia_storage_data_postgresql_password": "REPLACE_ME", + "var_authelia_storage_data_postgresql_schema": "authelia", + "var_authelia_storage_data_mariadb_host": "localhost", + "var_authelia_storage_data_mariadb_port": 3306, + "var_authelia_storage_data_mariadb_username": "authelia_user", + "var_authelia_storage_data_mariadb_password": "REPLACE_ME", + "var_authelia_storage_data_mariadb_schema": "authelia", "var_authelia_ntp_server": "time.cloudflare.com:123", "var_authelia_notification_mode": "smtp", "var_authelia_notification_file_path": "/var/authelia/notifications", diff --git a/ansible/roles/authelia/templates/conf-main.json.j2 b/ansible/roles/authelia/templates/conf-main.json.j2 index 5fa6b6d..096774a 100644 --- a/ansible/roles/authelia/templates/conf-main.json.j2 +++ b/ansible/roles/authelia/templates/conf-main.json.j2 @@ -126,9 +126,30 @@ }, "storage": { "encryption_key": "{{var_authelia_storage_encryption_key}}", +{% if var_authelia_storage_kind == "sqlite" %} "local": { - "path": "{{var_authelia_storage_path}}" + "path": "{{var_authelia_storage_data_sqlite_path}}" } +{% endif %} +{% if var_authelia_storage_kind == "postgresql" %} + "postgres": { + "host": "{{var_authelia_storage_data_postgresql_host}}", + "port": {{var_authelia_storage_data_postgresql_port | string}}, + "schema": "public", + "username": "{{var_authelia_storage_data_postgresql_username}}", + "password": "{{var_authelia_storage_data_postgresql_password}}", + "database": "{{var_authelia_storage_data_postgresql_schema}}" + } +{% endif %} +{% if var_authelia_storage_kind == "mariadb" %} + "mysql": { + "host": "{{var_authelia_storage_data_mariadb_host}}", + "port": {{var_authelia_storage_data_mariadb_port | string}}, + "username": "{{var_authelia_storage_data_mariadb_username}}", + "password": "{{var_authelia_storage_data_mariadb_password}}", + "database": "{{var_authelia_storage_data_mariadb_schema}}" + } +{% endif %} }, "notifier": { "disable_startup_check": true,