Refactor MariaDB and PostgreSQL roles for Ansible 2.20 compatibility and Infinito.Nexus conventions

- Replace legacy docker_container-based MariaDB deployment with docker-compose based workflow
- Add custom Dockerfile and docker-compose templates for MariaDB
- Split MariaDB command into separate arguments to avoid entrypoint parsing errors
- Introduce MARIADB_CUSTOM_IMAGE and MARIADB_EXPOSE_LOCAL variables
- Add docker_compose_flush_handlers to ensure correct handler execution on first run
- Replace utils/once/finalize.yml with utils/once/flag.yml for new run-once semantics
- Align variable naming with Infinito.Nexus UPPERCASE conventions
- Fix PostgreSQL custom image variable name (POSTGRES_CUSTOM_IMAGE_NAME → POSTGRES_CUSTOM_IMAGE)
- Remove obsolete flush_handlers var injection in svc-db-postgres/tasks/main.yml
- General cleanup after migration from Ansible 2.18 → 2.20

Conversation reference:
https://chatgpt.com/share/69306c81-9934-800f-b317-f53a8f246a73
This commit is contained in:
2025-12-03 18:00:30 +01:00
parent 13d47766b7
commit 379b1d420e
9 changed files with 51 additions and 44 deletions

View File

@@ -1,9 +1,11 @@
application_id: svc-db-mariadb
MARIADB_ROOT_PWD: "{{ applications | get_app_conf(application_id,'credentials.root_password') }}"
MARIADB_SUBNET: "{{ networks.local['svc-db-mariadb'].subnet }}"
MARIADB_NETWORK: "{{ applications | get_app_conf(application_id,'docker.network') }}"
MARIADB_VOLUME: "{{ applications | get_app_conf(application_id,'docker.volumes.data') }}"
MARIADB_IMAGE: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.image','mariadb') }}"
MARIADB_VERSION: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.version') }}"
MARIADB_NAME: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.name') }}"
MARIADB_PORT: "{{ database_port | default(ports.localhost.database[ application_id ]) }}"
application_id: svc-db-mariadb
MARIADB_ROOT_PWD: "{{ applications | get_app_conf(application_id,'credentials.root_password') }}"
MARIADB_SUBNET: "{{ networks.local['svc-db-mariadb'].subnet }}"
MARIADB_NETWORK: "{{ applications | get_app_conf(application_id,'docker.network') }}"
MARIADB_VOLUME: "{{ applications | get_app_conf(application_id,'docker.volumes.data') }}"
MARIADB_IMAGE: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.image','mariadb') }}"
MARIADB_VERSION: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.version') }}"
MARIADB_NAME: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.name') }}"
MARIADB_PORT: "{{ database_port | default(ports.localhost.database[ application_id ]) }}"
MARIADB_CUSTOM_IMAGE: "mariadb_custom"
MARIADB_EXPOSE_LOCAL: false