Ensure that keycloak is up

This commit is contained in:
2025-08-08 17:25:31 +02:00
parent c7b25ed093
commit aae69ea15b
27 changed files with 74 additions and 47 deletions

View File

@@ -0,0 +1,19 @@
- name: "load variables from {{ DOCKER_VARS_FILE }}"
include_vars: "{{ DOCKER_VARS_FILE }}"
- name: Set the directory to which keycloack import files will be copied on host
set_fact:
keycloak_host_import_directory: "{{ docker_compose.directories.volumes }}import/"
- name: "create directory {{keycloak_host_import_directory}}"
file:
path: "{{keycloak_host_import_directory}}"
state: directory
mode: 0755
- name: "Copy import files to {{ keycloak_host_import_directory }}"
template:
src: "{{ item }}"
dest: "{{ keycloak_host_import_directory }}/{{ item | basename | regex_replace('\\.j2$', '') }}"
mode: '770'
loop: "{{ lookup('fileglob', '{{ role_path }}/templates/import/*.j2', wantlist=True) }}"

View File

@@ -1,22 +1,11 @@
---
- name: "create import files for {{application_id}}"
include_tasks: 01_import.yml
- name: "load docker, db and proxy for {{application_id}}"
include_role:
name: cmp-db-docker-proxy
- name: "create directory {{keycloak_host_import_directory}}"
file:
path: "{{keycloak_host_import_directory}}"
state: directory
mode: 0755
- name: "Copy import files to {{ keycloak_host_import_directory }}"
template:
src: "{{ item }}"
dest: "{{ keycloak_host_import_directory }}/{{ item | basename | regex_replace('\\.j2$', '') }}"
mode: '770'
loop: "{{ lookup('fileglob', '{{ role_path }}/templates/import/*.j2', wantlist=True) }}"
notify: docker compose up
# Deactivated temporary. Import now via realm.yml
#- name: Implement SSH Public Key Attribut
# include_tasks: attributes/ssh_public_key.yml
# include_tasks: attributes/ssh_public_key.yml

View File

@@ -4,7 +4,6 @@ database_type: "postgres"
# Keycloak Specific
keycloak_container: "{{ applications | get_app_conf(application_id, 'docker.services.keycloak.name', True) }}" # Name of the keycloack docker container
keycloak_host_import_directory: "{{ docker_compose.directories.volumes }}import/" # Directory in which keycloack import files are placed on the host
keycloak_docker_import_directory: "/opt/keycloak/data/import/" # Directory in which keycloack import files are placed in the running docker container
keycloak_realm: "{{ primary_domain}}" # This is the name of the default realm which is used by the applications
keycloak_administrator: "{{ applications | get_app_conf(application_id, 'users.administrator', True) }}" # Master Administrator
@@ -20,4 +19,4 @@ keycloak_import_realm: "{{ applications | get_app_conf(application_id
keycloak_debug_enabled: "{{ enable_debug }}"
# Docker
docker_compose_flush_handlers: false # Copy realm import etc. before flush
docker_compose_flush_handlers: true # Remember to copy realm import before flushg when set to true