THE HUGE REFACTORING CALENDER WEEK 33; Optimized Matrix and during this updated variables, and implemented better reset and cleanup mode handling, also solved some initial setup bugs

This commit is contained in:
2025-08-15 15:15:48 +02:00
parent 0228014d34
commit 022800425d
271 changed files with 1098 additions and 916 deletions

View File

@@ -0,0 +1,16 @@
- name: "Load docker container role"
include_role:
name: docker-container
when: run_once_docker_container is not defined
- name: "reset (if enabled)"
include_tasks: 02_reset.yml
when: MODE_RESET | bool
- name: "create {{ PATH_DOCKER_COMPOSE_INSTANCES }}"
file:
path: "{{ PATH_DOCKER_COMPOSE_INSTANCES }}"
state: directory
mode: 0700
owner: root
group: root

View File

@@ -1,11 +0,0 @@
# It is necessary to shut the projects down, when reset is activated.
# Otherwise it can lead to this bug:
# https://github.com/ansible/ansible/issues/10244
- name: shut down docker compose project
command:
cmd: "docker-compose -p {{ application_id }} down"
- name: "Remove {{ docker_compose.directories.instance }} and all its contents"
file:
path: "{{ docker_compose.directories.instance }}"
state: absent

View File

@@ -0,0 +1,16 @@
# It is necessary to shut the projects down, when reset is activated.
# Otherwise it can lead to this bug:
# https://github.com/ansible/ansible/issues/10244
- name: "pkgmgr install '{{ DOCKER_COMPOSE_DOWN_ALL_PACKAGE }}'"
include_role:
name: pkgmgr-install
vars:
package_name: "{{ DOCKER_COMPOSE_DOWN_ALL_PACKAGE }}"
- name: Shutdown all docker compose instances in '{{ PATH_DOCKER_COMPOSE_INSTANCES }}' with '{{ DOCKER_COMPOSE_DOWN_ALL_PACKAGE }}'
command: "{{ DOCKER_COMPOSE_DOWN_ALL_PACKAGE }} {{ PATH_DOCKER_COMPOSE_INSTANCES }}"
- name: "Remove directory '{{ PATH_DOCKER_COMPOSE_INSTANCES }}' and all its contents"
file:
path: "{{ PATH_DOCKER_COMPOSE_INSTANCES }}"
state: absent

View File

@@ -1,16 +1,10 @@
- block:
- include_role:
name: docker-container
when: run_once_docker_container is not defined
- include_tasks: 01_core.yml
- include_tasks: utils/run_once.yml
when: run_once_docker_compose is not defined
- name: "Load variables from {{ docker_compose_variable_file }} for whole play"
include_vars: "{{ docker_compose_variable_file }}"
- name: "reset (if enabled)"
include_tasks: 01_reset.yml
when: MODE_RESET | bool
- name: "Load variables from {{ DOCKER_COMPOSE_VARIABLE_FILE }} for whole play"
include_vars: "{{ DOCKER_COMPOSE_VARIABLE_FILE }}"
# This could lead to problems in docker-compose directories which are based on a git repository
# @todo Verify that this isn't the case. E.g. in accounting
@@ -21,15 +15,15 @@
mode: '0755'
with_dict: "{{ docker_compose.directories }}"
- name: "Include routines to set up a git repository based installation for '{{application_id}}'."
include_tasks: "02_repository.yml"
- name: "Include routines to set up a git repository based installation for '{{ application_id }}'."
include_tasks: "03_repository.yml"
when: docker_pull_git_repository | bool
- block:
- name: "Include file management routines for '{{application_id}}'."
include_tasks: "03_files.yml"
- name: "Include file management routines for '{{ application_id }}'."
include_tasks: "04_files.yml"
- name: "Ensure that {{ docker_compose.directories.instance }} is up"
include_tasks: "04_ensure_up.yml"
include_tasks: "05_ensure_up.yml"
when: not docker_compose_skipp_file_creation | bool
- name: "flush docker compose for '{{ application_id }}'"

View File

@@ -1,2 +1,2 @@
# @See https://chatgpt.com/share/67a23d18-fb54-800f-983c-d6d00752b0b4
docker_compose: "{{ application_id | get_docker_paths(path_docker_compose_instances) }}"
docker_compose: "{{ application_id | get_docker_paths(PATH_DOCKER_COMPOSE_INSTANCES) }}"

View File

@@ -1 +1,2 @@
docker_compose_variable_file: "{{ role_path }}/vars/docker-compose.yml"
DOCKER_COMPOSE_VARIABLE_FILE: "{{ role_path }}/vars/docker-compose.yml"
DOCKER_COMPOSE_DOWN_ALL_PACKAGE: "docodol"