You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hetzner-ansible/roles/keycloak_compact/tasks/main.yml

86 lines
2.4 KiB
YAML

---
### tags:
### configure_realm
- name: "Setup DNS configuration for <{{ keycloak_id }}> to <{{ stage_server_ip }}>"
include_role:
name: dns
vars:
record_data: "{{ stage_server_ip }}"
record_name: "{{ keycloak_id }}"
- name: "Setup DNS configuration for <{{ keycloak_external_domain }}> to <{{ stage_server_ip }}>"
include_role:
name: dns
vars:
record_data: "{{ stage_server_ip }}"
record_name: "{{ keycloak_external_domain }}"
when: keycloak_external_domain is defined
- name: "Check if {{ keycloak_id }}/docker-compose.yml exists"
stat:
path: '{{ service_base_path }}/{{ keycloak_id }}/docker-compose.yml'
register: check_docker_compose_file
- name: "Stop {{ keycloak_id }}"
community.docker.docker_compose:
project_src: '{{ service_base_path }}/{{ keycloak_id }}'
state: absent
when: check_docker_compose_file.stat.exists
- name: "Deploy docker templates for {{ keycloak_id }}"
include_role:
name: sma_deploy
tasks_from: templates
vars:
current_config: "keycloak-compact"
current_base_path: "{{ service_base_path }}"
current_destination: "{{ keycloak_id }}"
current_owner: "{{ docker_owner }}"
current_group: "{{ docker_group }}"
# TODO DEV-XXX check why docker-compose up works and the comnuity role not... -> postgres/keycloak
- name: "Start {{ keycloak_id }}" # noqa command-instead-of-shell no-changed-when
shell: docker-compose up -d
args:
chdir: '{{ service_base_path }}/{{ keycloak_id }}'
#- name: "Restart {{ keycloak_id }}"
# community.docker.docker_compose:
# project_src: '{{ service_base_path }}/{{ keycloak_id }}'
# restarted: yes
# build: no
- name: "Setting local keycloak url"
set_fact:
keycloak_server_url: "http://localhost:{{ service_port_keycloak_external }}"
tags:
- configure_realm
- name: "Wait for <localhost:{{ service_port_keycloak_external }}>"
wait_for:
host: "localhost"
port: '{{ service_port_keycloak_external }}'
delay: 60
- name: "Setup realm for {{ inventory_hostname }}"
include_role:
name: keycloak
tasks_from: _authenticate
apply:
tags:
- configure_realm
tags:
- configure_realm
- name: "Setup realm for {{ inventory_hostname }}"
include_role:
name: keycloak
tasks_from: _configure_realm
apply:
tags:
- configure_realm
tags:
- configure_realm