mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Decoupeld database, docker and proxy
This commit is contained in:
25
roles/cmp-db-docker/README.md
Normal file
25
roles/cmp-db-docker/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Database Docker Composition
|
||||
|
||||
This role combines the central RDBMS role (`svc-rdbms-central`) with Docker Compose to deliver a ready-to-use containerized database environment.
|
||||
|
||||
## Features
|
||||
|
||||
- **Central RDBMS Integration**
|
||||
Includes the `svc-rdbms-central` role, which handles backups, restores, user and permission management for your relational database system (PostgreSQL, MariaDB, etc.).
|
||||
|
||||
- **Docker Compose**
|
||||
Utilizes the standalone `docker-compose` role to define and bring up containers, networks, and volumes automatically.
|
||||
|
||||
- **Variable Load Order**
|
||||
1. Docker Compose variables (`roles/docker-compose/vars/docker-compose.yml`)
|
||||
2. Database variables (`roles/svc-rdbms-central/vars/database.yml`)
|
||||
Ensures compose ports and volumes are defined before the database role consumes them.
|
||||
|
||||
The role will load both sub-roles and satisfy all dependencies transparently.
|
||||
|
||||
## Task Breakdown
|
||||
|
||||
1. **Set Fact** `database_application_id` to work around lazy‐loading ordering.
|
||||
2. **Include Vars** in the specified order.
|
||||
3. **Invoke** `docker-compose` role to create containers, networks, and volumes.
|
||||
4. **Invoke** `svc-rdbms-central` role to provision the database, backups, and users.
|
17
roles/cmp-db-docker/meta/main.yml
Normal file
17
roles/cmp-db-docker/meta/main.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: >
|
||||
Combines Docker Compose with a central RDBMS role to automatically
|
||||
provision database containers with backup, user, and permission management.
|
||||
company: |
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
license: "CyMaIS NonCommercial License (CNCL)"
|
||||
license_url: "https://s.veen.world/cncl"
|
||||
galaxy_tags:
|
||||
- docker
|
||||
- database
|
||||
- rdbms
|
||||
- backup
|
||||
- compose
|
17
roles/cmp-db-docker/tasks/main.yml
Normal file
17
roles/cmp-db-docker/tasks/main.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
- name: "set database_application_id (Needed due to lazzy loading issue)"
|
||||
set_fact:
|
||||
database_application_id: "{{ application_id }}"
|
||||
|
||||
- name: "Load database variables"
|
||||
include_vars: "{{ item }}"
|
||||
loop:
|
||||
- "{{ cmp_db_docker_vars_file_docker }}" # Important to load docker variables first so that database can use them
|
||||
- "{{ cmp_db_docker_vars_file_db }}" # Important to load them before docker role so that backup can use them
|
||||
|
||||
- name: "Load docker-compose for {{ application_id }}"
|
||||
include_role:
|
||||
name: docker-compose
|
||||
|
||||
- name: "Load central rdbms for {{ application_id }}"
|
||||
include_role:
|
||||
name: svc-rdbms-central
|
2
roles/cmp-db-docker/vars/main.yml
Normal file
2
roles/cmp-db-docker/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
cmp_db_docker_vars_file_db: "{{ playbook_dir }}/roles/svc-rdbms-central/vars/database.yml"
|
||||
cmp_db_docker_vars_file_docker: "{{ playbook_dir }}/roles/docker-compose/vars/docker-compose.yml"
|
Reference in New Issue
Block a user