move health url fact to variables

main
Guido Grazioli 2022-01-27 14:23:11 +01:00
parent 8882b36c83
commit 0f02037746
No known key found for this signature in database
GPG Key ID: 22C8C31EF2BC093B
3 changed files with 14 additions and 13 deletions

View File

@ -30,7 +30,7 @@
retries: 2
delay: 2
rescue:
- name: create Keycloak admin user
- name: "Create {{ keycloak.service_name }} admin user"
command:
args:
argv:
@ -39,11 +39,11 @@
- "-u{{ keycloak_admin_user }}"
- "-p{{ keycloak_admin_password }}"
become: yes
- name: restart keycloak
- name: "Restart {{ keycloak.service_name }}"
include_tasks: tasks/restart_keycloak.yml
- name: "Wait until Keycloak becomes active {{ health_url }}"
- name: "Wait until {{ keycloak.service_name }} becomes active {{ keycloak.health_url }}"
uri:
url: "{{ health_url }}"
url: "{{ keycloak.health_url }}"
register: keycloak_status
until: keycloak_status.status == 200
retries: 25

View File

@ -38,9 +38,6 @@
daemon_reload: yes
when: systemdunit.changed
- set_fact:
health_url: "{{ keycloak_management_url }}/health"
- name: start keycloak
systemd:
name: keycloak
@ -48,20 +45,22 @@
state: started
become: yes
- command: "systemctl status keycloak"
- name: Check service status
command: "systemctl status keycloak"
register: keycloak_service_status
changed_when: False
- assert:
- name: Verify service status
assert:
that:
- keycloak_service_status is defined
- keycloak_service_status.stdout is defined
- meta: flush_handlers
- name: "Wait until Keycloak becomes active {{ health_url }}"
- name: "Wait until Keycloak becomes active {{ keycloak.health_url }}"
uri:
url: "{{ health_url }}"
url: "{{ keycloak.health_url }}"
register: keycloak_status
until: keycloak_status.status == 200
retries: 25

View File

@ -16,7 +16,9 @@ keycloak_management_url: "http://{{ keycloak_host }}:{{ keycloak_management_http
keycloak:
home: "{{ keycloak_jboss_home }}"
config_dir: "{{ keycloak_config_dir }}"
bundle: "{{ keycloak_rhsso_archive if keycloak_rhsso_enable else keycloak_archive }}"
service_name: "{{ 'rhsso' if keycloak_rhsso_enable else 'keycloak') }}"
health_url: "{{ keycloak_management_url }}/health"
# database
keycloak_jdbc: