Optimized database variables

This commit is contained in:
2025-12-02 11:59:55 +01:00
parent 13b10ff85b
commit 0756e9d06e
4 changed files with 14 additions and 13 deletions

View File

@@ -13,7 +13,7 @@
name: "{{ database_name }}"
state: present
login_user: postgres
login_password: "{{ applications | get_app_conf(application_id, 'credentials.POSTGRES_PASSWORD', True) }}"
login_password: "{{ POSTGRES_PASSWORD }}"
login_host: "{{ POSTGRES_LOCAL_HOST }}"
login_port: "{{ POSTGRES_PORT }}"
register: postgresql_result
@@ -29,7 +29,7 @@
db: "{{ database_name }}"
state: present
login_user: postgres
login_password: "{{ applications | get_app_conf(application_id, 'credentials.POSTGRES_PASSWORD', True) }}"
login_password: "{{ POSTGRES_PASSWORD }}"
login_host: "{{ POSTGRES_LOCAL_HOST }}"
login_port: "{{ POSTGRES_PORT }}"
register: postgresql_result
@@ -42,7 +42,7 @@
community.postgresql.postgresql_query:
db: postgres
login_user: postgres
login_password: "{{ applications | get_app_conf(application_id, 'credentials.POSTGRES_PASSWORD', True) }}"
login_password: "{{ POSTGRES_PASSWORD }}"
login_host: "{{ POSTGRES_LOCAL_HOST }}"
login_port: "{{ POSTGRES_PORT }}"
query: |
@@ -64,7 +64,7 @@
schema: public
state: present
login_user: postgres
login_password: "{{ applications | get_app_conf(application_id, 'credentials.POSTGRES_PASSWORD', True) }}"
login_password: "{{ POSTGRES_PASSWORD }}"
login_host: "{{ POSTGRES_LOCAL_HOST }}"
login_port: "{{ POSTGRES_PORT }}"
register: postgresql_result
@@ -81,7 +81,7 @@
privs: ALL
state: present
login_user: postgres
login_password: "{{ applications | get_app_conf(application_id, 'credentials.POSTGRES_PASSWORD', True) }}"
login_password: "{{ POSTGRES_PASSWORD }}"
login_host: "{{ POSTGRES_LOCAL_HOST }}"
login_port: "{{ POSTGRES_PORT }}"
register: postgresql_result
@@ -94,7 +94,7 @@
community.postgresql.postgresql_query:
db: "{{ database_name }}"
login_user: postgres
login_password: "{{ applications | get_app_conf(application_id, 'credentials.POSTGRES_PASSWORD', True) }}"
login_password: "{{ POSTGRES_PASSWORD }}"
login_host: "{{ POSTGRES_LOCAL_HOST }}"
login_port: "{{ POSTGRES_PORT }}"
query: |
@@ -114,7 +114,7 @@
ext: "{{ item }}"
state: present
login_user: postgres
login_password: "{{ applications | get_app_conf(application_id, 'credentials.POSTGRES_PASSWORD', True) }}"
login_password: "{{ POSTGRES_PASSWORD }}"
login_host: "{{ POSTGRES_LOCAL_HOST }}"
login_port: "{{ POSTGRES_PORT }}"
loop:
@@ -134,7 +134,7 @@
ext: vector
state: present
login_user: postgres
login_password: "{{ applications | get_app_conf(application_id, 'credentials.POSTGRES_PASSWORD', True) }}"
login_password: "{{ POSTGRES_PASSWORD }}"
login_host: "{{ POSTGRES_LOCAL_HOST }}"
login_port: "{{ POSTGRES_PORT }}"
register: postgresql_result

View File

@@ -13,8 +13,6 @@
- name: "For '{{ application_id }}': Load central RDBMS"
include_role:
name: sys-svc-rdbms
vars:
database_init: true # Initialize a custom database for the application
- name: "For '{{ application_id }}': Load sys-stk-back-stateless"
include_role:

View File

@@ -13,14 +13,16 @@
src: "env/{{ database_type }}.env.j2"
dest: "{{ database_env }}"
notify: docker compose up
when: not applications | get_app_conf(application_id, 'features.central_database', False)
when: not (SYS_SVC_RDBMS_CENTRAL_DB_ENABLED | bool)
- name: "For '{{ application_id }}': Create central database"
# I don't know why this includes leads to that the application_id in vars/main.yml of the database role isn't used
# This is the behaviour which I want, but I'm still wondering why ;)
include_role:
name: "svc-db-{{ database_type }}"
when: applications | get_app_conf(application_id, 'features.central_database', False)
when: SYS_SVC_RDBMS_CENTRAL_DB_ENABLED | bool
vars:
database_init: true # Initialize a custom database for the application
- name: "For '{{ application_id }}': Add Entry for Backup Procedure"
include_tasks: "{{ playbook_dir }}/roles/sys-ctl-bkp-docker-2-loc/tasks/04_seed-database-to-backup.yml"

View File

@@ -1,2 +1,3 @@
# Docker
docker_pull_git_repository: false # Deactivated here to don't inhire this
docker_pull_git_repository: false # Deactivated here to don't inhire this
SYS_SVC_RDBMS_CENTRAL_DB_ENABLED: "{{ applications | get_app_conf(application_id, 'features.central_database', False) }}"