mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Replaced enable_central_database by configuration in application
This commit is contained in:
@@ -47,7 +47,7 @@ When executed, the role will:
|
||||
1. Load database configuration variables.
|
||||
2. Generate the appropriate environment file for the database.
|
||||
3. Incorporate the Docker Compose routines.
|
||||
4. Create a central database if `enable_central_database` is set to `true`.
|
||||
4. Create a central database if `applications[application_id].database.central_storage` is set to `true`.
|
||||
|
||||
---
|
||||
|
||||
|
@@ -14,9 +14,9 @@
|
||||
src: "env/{{database_type}}.env.j2"
|
||||
dest: "{{database_env}}"
|
||||
notify: docker compose project build and setup
|
||||
when: not enable_central_database | bool
|
||||
when: not applications[application_id].database.central_storage | bool
|
||||
|
||||
- name: create central database
|
||||
include_role:
|
||||
name: "docker-{{database_type}}"
|
||||
when: enable_central_database | bool
|
||||
when: applications[application_id].database.central_storage | bool
|
@@ -1,5 +1,5 @@
|
||||
# This template needs to be included in docker-compose.yml, which depend on a mariadb database
|
||||
{% if not enable_central_database | bool %}
|
||||
{% if not applications[application_id].database.central_storage | bool %}
|
||||
database:
|
||||
container_name: {{application_id}}-database
|
||||
logging:
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# This template needs to be included in docker-compose.yml, which depend on a postgres database
|
||||
{% if not enable_central_database | bool %}
|
||||
{% if not applications[application_id].database.central_storage | bool %}
|
||||
database:
|
||||
image: postgres:{{applications.postgres.database_version}}-alpine
|
||||
container_name: {{application_id}}-database
|
||||
|
@@ -1,5 +1,5 @@
|
||||
database_instance: "{{ 'central-' + database_type if enable_central_database | bool else application_id }}"
|
||||
database_host: "{{ 'central-' + database_type if enable_central_database | bool else 'database' }}"
|
||||
database_instance: "{{ 'central-' + database_type if applications[application_id].database.central_storage | bool else application_id }}"
|
||||
database_host: "{{ 'central-' + database_type if applications[application_id].database.central_storage | bool else 'database' }}"
|
||||
database_name: "{{ application_id }}"
|
||||
database_username: "{{ application_id }}"
|
||||
database_port: "{{ 3306 if database_type == 'mariadb' else 5432 }}"
|
||||
|
@@ -11,7 +11,7 @@
|
||||
command:
|
||||
cmd: "docker network connect {{applications.discourse.network}} central-{{ database_type }}"
|
||||
ignore_errors: true
|
||||
when: enable_central_database | bool
|
||||
when: applications[application_id].database.central_storage | bool
|
||||
listen: recreate discourse
|
||||
|
||||
- name: rebuild discourse
|
||||
|
@@ -65,10 +65,10 @@
|
||||
command:
|
||||
cmd: "docker network connect central_postgres {{applications.discourse.container}}"
|
||||
ignore_errors: true
|
||||
when: enable_central_database | bool
|
||||
when: applications[application_id].database.central_storage | bool
|
||||
|
||||
- name: "remove central database from {{application_id}}_default"
|
||||
command:
|
||||
cmd: "docker network disconnect {{applications.discourse.network}} central-{{ database_type }}"
|
||||
ignore_errors: true
|
||||
when: enable_central_database | bool
|
||||
when: applications[application_id].database.central_storage | bool
|
||||
|
@@ -1,5 +1,5 @@
|
||||
templates:
|
||||
{% if not enable_central_database | bool %}
|
||||
{% if not applications[application_id].database.central_storage | bool %}
|
||||
- "templates/postgres.template.yml"
|
||||
{% endif %}
|
||||
#- "templates/redis.template.yml"
|
||||
|
@@ -4,11 +4,6 @@ database_type: "mariadb"
|
||||
cert_mount_directory: "{{docker_compose.directories.volumes}}certs/"
|
||||
enable_wildcard_certificate: false
|
||||
|
||||
# I don't know why this configuration is necessary.
|
||||
# Propabldy due to a database migration problem, or dificulties to configure an external db in mailu
|
||||
# @todo research
|
||||
enable_central_database: "{{applications.mailu.enable_central_database}}"
|
||||
|
||||
# Use dedicated source for oidc if activated
|
||||
# @see https://github.com/heviat/Mailu-OIDC/tree/2024.06
|
||||
docker_source: "{{ 'ghcr.io/heviat' if applications[application_id].oidc.enabled | bool else 'ghcr.io/mailu' }}"
|
@@ -7,7 +7,7 @@
|
||||
- name: "create {{database_name}} database"
|
||||
include_role:
|
||||
name: docker-postgres
|
||||
when: enable_central_database | bool
|
||||
when: applications[application_id].database.central_storage | bool
|
||||
|
||||
- name: "include seed-database-to-backup.yml"
|
||||
include_tasks: "{{ playbook_dir }}/roles/backup-docker-to-local/tasks/seed-database-to-backup.yml"
|
@@ -1,3 +1,3 @@
|
||||
application_id: "phpmyadmin"
|
||||
database_type: "mariadb"
|
||||
database_host: "{{ 'central-' + database_type if enable_central_database}}"
|
||||
database_host: "{{ 'central-' + database_type if applications[application_id].database.central_storage}}"
|
@@ -27,7 +27,7 @@ DB_DATABASE={{database_name}}
|
||||
DB_USERNAME={{database_username}}
|
||||
DB_PASSWORD={{database_password}}
|
||||
|
||||
{% if not enable_central_database | bool %}
|
||||
{% if not applications[application_id].database.central_storage | bool %}
|
||||
MYSQL_ROOT_PASSWORD={{database_password}}
|
||||
DB_PREFIX=null
|
||||
DB_DUMP_PATH='/usr/bin'
|
||||
|
@@ -1,4 +1,3 @@
|
||||
application_id: "snipe_it"
|
||||
database_password: "{{applications.snipe_it.database_password}}"
|
||||
database_type: "mariadb"
|
||||
# enable_central_database: false For debugging reasons here
|
||||
database_type: "mariadb"
|
Reference in New Issue
Block a user