move health url fact to variables

This commit is contained in:
Guido Grazioli 2022-01-27 14:23:11 +01:00
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

@ -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