Refactored database_password and solved related bugs

This commit is contained in:
Kevin Veen-Birkenbach 2025-05-11 12:19:33 +02:00
parent 3405f3a8f9
commit 064dd01508
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
22 changed files with 18 additions and 29 deletions

View File

@ -3,6 +3,7 @@
- name: "Display all database variables" - name: "Display all database variables"
debug: debug:
msg: | msg: |
database_application_id: "{{ database_application_id | default('undefined') }}"
database_instance: "{{ database_instance | default('undefined') }}" database_instance: "{{ database_instance | default('undefined') }}"
database_name: "{{ database_name | default('undefined') }}" database_name: "{{ database_name | default('undefined') }}"
database_type: "{{ database_type | default('undefined') }}" database_type: "{{ database_type | default('undefined') }}"

View File

@ -1,3 +1,7 @@
- name: "set _tmp_database_application_id (Needed due to lazzy loading issue)"
set_fact:
database_application_id: "{{ application_id }}"
- name: "Load database variables" - name: "Load database variables"
include_vars: "{{ item }}" include_vars: "{{ item }}"
loop: loop:

View File

@ -1,7 +1,8 @@
database_instance: "{{ 'central-' + database_type if applications | is_feature_enabled('central_database',application_id) else application_id }}" database_instance: "{{ 'central-' + database_type if applications | is_feature_enabled('central_database',database_application_id) else database_application_id }}"
database_host: "{{ 'central-' + database_type if applications | is_feature_enabled('central_database',application_id) else 'database' }}" database_host: "{{ 'central-' + database_type if applications | is_feature_enabled('central_database',database_application_id) else 'database' }}"
database_name: "{{ applications[application_id].database.name | default( application_id ) }}" # The overwritte configuration is needed by bigbluebutton database_name: "{{ applications[database_application_id].database.name | default( database_application_id ) }}" # The overwritte configuration is needed by bigbluebutton
database_username: "{{ applications[application_id].database.username | default( application_id )}}" # The overwritte configuration is needed by bigbluebutton database_username: "{{ applications[database_application_id].database.username | default( database_application_id )}}" # The overwritte configuration is needed by bigbluebutton
database_password: "{{ applications[database_application_id].credentials.database_password }}"
database_port: "{{ 3306 if database_type == 'mariadb' else 5432 }}" database_port: "{{ 3306 if database_type == 'mariadb' else 5432 }}"
database_env: "{{docker_compose.directories.env}}{{database_type}}.env" database_env: "{{docker_compose.directories.env}}{{database_type}}.env"
database_url_jdbc: "jdbc:{{ database_type if database_type == 'mariadb' else 'postgresql' }}://{{ database_host }}:{{ database_port }}/{{ database_name }}" database_url_jdbc: "jdbc:{{ database_type if database_type == 'mariadb' else 'postgresql' }}://{{ database_host }}:{{ database_port }}/{{ database_name }}"

View File

@ -1,5 +1,3 @@
application_id: "espocrm" application_id: "espocrm"
# Password for the espocrm DB user (taken from inventory applications dict)
database_password: "{{ applications[application_id].credentials.database_password }}"
# EspoCRM uses MySQL/MariaDB # EspoCRM uses MySQL/MariaDB
database_type: "mariadb" database_type: "mariadb"

View File

@ -1,6 +1,5 @@
application_id: "funkwhale" application_id: "funkwhale"
nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 512M;" nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 512M;"
database_password: "{{applications[application_id].credentials.database_password}}"
database_type: "postgres" database_type: "postgres"
media_root: "/srv/funkwhale/data/" media_root: "/srv/funkwhale/data/"
static_root: "{{media_root}}static" static_root: "{{media_root}}static"

View File

@ -1,3 +1,2 @@
application_id: "gitea" application_id: "gitea"
database_password: "{{applications[application_id].credentials.database_password}}"
database_type: "mariadb" database_type: "mariadb"

View File

@ -1,3 +1,2 @@
application_id: "gitlab" application_id: "gitlab"
database_password: "{{applications[application_id].credentials.database_password}}"
database_type: "postgres" database_type: "postgres"

View File

@ -1,6 +1,5 @@
application_id: "keycloak" application_id: "keycloak"
database_type: "postgres" database_type: "postgres"
database_password: "{{applications[application_id].credentials.database_password}}"
container_name: "{{application_id}}_application" container_name: "{{application_id}}_application"
realm: "{{primary_domain}}" # This is the name of the default realm which is used by the applications realm: "{{primary_domain}}" # This is the name of the default realm which is used by the applications
import_directory_host: "{{docker_compose.directories.volumes}}import/" # Directory in which keycloack import files are placed on the host import_directory_host: "{{docker_compose.directories.volumes}}import/" # Directory in which keycloack import files are placed on the host

View File

@ -1,5 +1,4 @@
application_id: "listmonk" application_id: "listmonk"
database_password: "{{applications[application_id].credentials.database_password}}"
database_type: "postgres" database_type: "postgres"
listmonk_settings: listmonk_settings:

View File

@ -1,3 +1,2 @@
application_id: "mastodon" application_id: "mastodon"
database_password: "{{applications[application_id].credentials.database_password}}"
database_type: "postgres" database_type: "postgres"

View File

@ -1,7 +1,6 @@
--- ---
application_id: "matomo" application_id: "matomo"
database_type: "mariadb" database_type: "mariadb"
database_password: "{{ applications[application_id].credentials.database_password }}"
# I don't know if this is still necessary # I don't know if this is still necessary
domain: "{{ domains[application_id] }}" domain: "{{ domains[application_id] }}"

View File

@ -52,7 +52,7 @@ devture_traefik_config_certificatesResolvers_acme_email: "{{users.administrator.
# #
# The playbook creates additional Postgres users and databases (one for each enabled service) # The playbook creates additional Postgres users and databases (one for each enabled service)
# using this superuser account. # using this superuser account.
devture_postgres_connection_password: "{{applications[application_id].credentials.database_password}}" devture_postgres_connection_password: "{{database_password}}"
# By default, we configure Coturn's external IP address using the value specified for `ansible_host` in your `inventory/hosts` file. # By default, we configure Coturn's external IP address using the value specified for `ansible_host` in your `inventory/hosts` file.
# If this value is an external IP address, you can skip this section. # If this value is an external IP address, you can skip this section.

View File

@ -1,6 +1,5 @@
--- ---
application_id: "matrix" application_id: "matrix"
database_password: "{{applications[application_id].credentials.database_password}}"
database_type: "postgres" database_type: "postgres"
registration_file_folder: "/data/" registration_file_folder: "/data/"
well_known_directory: "{{nginx.directories.data.well_known}}/matrix/" well_known_directory: "{{nginx.directories.data.well_known}}/matrix/"

View File

@ -2,7 +2,7 @@ MOODLE_DATABASE_HOST={{database_host}}
MOODLE_DATABASE_PORT_NUMBER={{database_port}} MOODLE_DATABASE_PORT_NUMBER={{database_port}}
MOODLE_DATABASE_USER={{database_username}} MOODLE_DATABASE_USER={{database_username}}
MOODLE_DATABASE_NAME={{database_name}} MOODLE_DATABASE_NAME={{database_name}}
applications[application_id].credentials.database_password={{database_password}} MOODLE_DATABASE_PASSWORD={{database_password}}
ALLOW_EMPTY_PASSWORD=no ALLOW_EMPTY_PASSWORD=no
MOODLE_SITE_NAME="{{applications.moodle.site_titel}}" MOODLE_SITE_NAME="{{applications.moodle.site_titel}}"
MOODLE_SSLPROXY=yes MOODLE_SSLPROXY=yes

View File

@ -1,6 +1,5 @@
application_id: "openproject" application_id: "openproject"
docker_repository_address: "https://github.com/opf/openproject-deploy" docker_repository_address: "https://github.com/opf/openproject-deploy"
database_password: "{{ applications[application_id].credentials.database_password }}"
database_type: "postgres" database_type: "postgres"
openproject_plugins_service: "{{docker_compose.directories.services}}plugins/" openproject_plugins_service: "{{docker_compose.directories.services}}plugins/"

View File

@ -1,9 +1,9 @@
# Database / Postgres service configuration # Database / Postgres service configuration
POSTGRES_USER={{database_username}} POSTGRES_USER={{database_username}}
POSTGRES_PASSWORD={{applications[application_id].credentials.database_password}} POSTGRES_PASSWORD={{database_password}}
POSTGRES_DB={{database_name}} POSTGRES_DB={{database_name}}
PEERTUBE_DB_USERNAME={{database_username}} PEERTUBE_DB_USERNAME={{database_username}}
PEERTUBE_DB_PASSWORD={{applications[application_id].credentials.database_password}} PEERTUBE_DB_PASSWORD={{database_password}}
PEERTUBE_DB_SSL=false PEERTUBE_DB_SSL=false
PEERTUBE_DB_HOSTNAME={{database_host}} PEERTUBE_DB_HOSTNAME={{database_host}}

View File

@ -1,3 +1,2 @@
application_id: "peertube" application_id: "peertube"
database_type: "postgres" database_type: "postgres"
database_password: "{{applications[application_id].credentials.database_password}}"

View File

@ -1,6 +1,5 @@
application_id: "pgadmin" application_id: "pgadmin"
database_type: "postgres" database_type: "postgres"
database_host: "{{ 'central-' + database_type if applications | is_feature_enabled('central_database',application_id)" database_host: "{{ 'central-' + database_type if applications | is_feature_enabled('central_database',application_id)"
database_var_file: "{{playbook_dir}}/roles/docker-central-database/vars/database.yml"
pgadmin_user: 5050 pgadmin_user: 5050
pgadmin_group: "{{pgadmin_user}}" pgadmin_group: "{{pgadmin_user}}"

View File

@ -1,4 +1,3 @@
application_id: "pixelfed" application_id: "pixelfed"
nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 512M;" nginx_docker_reverse_proxy_extra_configuration: "client_max_body_size 512M;"
database_type: "mariadb" database_type: "mariadb"
database_password: "{{applications[application_id].credentials.database_password}}"

View File

@ -1,6 +1,5 @@
application_id: "taiga" application_id: "taiga"
database_type: "postgres" database_type: "postgres"
database_password: "{{applications[application_id].credentials.database_password}}"
docker_repository_address: "https://github.com/taigaio/taiga-docker" docker_repository_address: "https://github.com/taigaio/taiga-docker"
email_backend: "smtp" ## use an SMTP server or display the emails in the console (either "smtp" or "console") email_backend: "smtp" ## use an SMTP server or display the emails in the console (either "smtp" or "console")
docker_compose_init: "{{docker_compose.directories.instance}}docker-compose-inits.yml.j2" docker_compose_init: "{{docker_compose.directories.instance}}docker-compose-inits.yml.j2"

View File

@ -1,7 +1,6 @@
application_id: "wordpress" application_id: "wordpress"
wordpress_max_upload_size: "64M" wordpress_max_upload_size: "64M"
database_type: "mariadb" database_type: "mariadb"
database_password: "{{applications[application_id].credentials.database_password}}"
wordpress_custom_image: "wordpress_custom" wordpress_custom_image: "wordpress_custom"
wordpress_docker_html_path: "/var/www/html" wordpress_docker_html_path: "/var/www/html"
host_msmtp_conf: "{{docker_compose.directories.config}}msmtprc.conf" host_msmtp_conf: "{{docker_compose.directories.config}}msmtprc.conf"

View File

@ -1,3 +1,2 @@
application_id: "yourls" application_id: "yourls"
database_type: "mariadb" database_type: "mariadb"
database_password: "{{applications[application_id].credentials.database_password}}"