mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2025-07-25 14:20:32 -07:00
parameterize health check; refactor serial_then_parallel
This commit is contained in:
parent
f63b20b9d4
commit
4b21569f36
5 changed files with 23 additions and 28 deletions
|
@ -103,6 +103,8 @@ Role Defaults
|
||||||
|`keycloak_quarkus_systemd_wait_for_delay`| Activation delay for service systemd unit (seconds) | `10` |
|
|`keycloak_quarkus_systemd_wait_for_delay`| Activation delay for service systemd unit (seconds) | `10` |
|
||||||
|`keycloak_quarkus_restart_strategy`| Strategy task file for restarting in HA (one of provided restart/['serial.yml','none.yml','serial_then_parallel.yml']) or path to file when providing custom strategy | `restart/serial.yml` |
|
|`keycloak_quarkus_restart_strategy`| Strategy task file for restarting in HA (one of provided restart/['serial.yml','none.yml','serial_then_parallel.yml']) or path to file when providing custom strategy | `restart/serial.yml` |
|
||||||
|`keycloak_quarkus_restart_health_check`| Whether to wait for successful health check after restart | `{{ keycloak_quarkus_ha_enabled }}` |
|
|`keycloak_quarkus_restart_health_check`| Whether to wait for successful health check after restart | `{{ keycloak_quarkus_ha_enabled }}` |
|
||||||
|
|`keycloak_quarkus_restart_health_check_delay`| Seconds to let pass before starting healch checks | `10` |
|
||||||
|
|`keycloak_quarkus_restart_health_check_reries`| Number of attempts for successful health check before failing | `25` |
|
||||||
|`keycloak_quarkus_restart_pause`| Seconds to wait between restarts in HA strategy | `15` |
|
|`keycloak_quarkus_restart_pause`| Seconds to wait between restarts in HA strategy | `15` |
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -157,4 +157,6 @@ keycloak_quarkus_supported_policy_types: ['password-blacklists']
|
||||||
# files in restart directory (one of [ 'serial', 'none', 'serial_then_parallel' ]), or path to file when providing custom strategy
|
# files in restart directory (one of [ 'serial', 'none', 'serial_then_parallel' ]), or path to file when providing custom strategy
|
||||||
keycloak_quarkus_restart_strategy: restart/serial.yml
|
keycloak_quarkus_restart_strategy: restart/serial.yml
|
||||||
keycloak_quarkus_restart_health_check: "{{ keycloak_quarkus_ha_enabled }}"
|
keycloak_quarkus_restart_health_check: "{{ keycloak_quarkus_ha_enabled }}"
|
||||||
|
keycloak_quarkus_restart_health_check_delay: 10
|
||||||
|
keycloak_quarkus_restart_health_check_reries: 25
|
||||||
keycloak_quarkus_restart_pause: 15
|
keycloak_quarkus_restart_pause: 15
|
||||||
|
|
|
@ -445,6 +445,14 @@ argument_specs:
|
||||||
description: "Seconds to wait between restarts in HA strategy"
|
description: "Seconds to wait between restarts in HA strategy"
|
||||||
default: 15
|
default: 15
|
||||||
type: int
|
type: int
|
||||||
|
keycloak_quarkus_restart_health_check_delay:
|
||||||
|
description: "Seconds to let pass before starting healch checks"
|
||||||
|
default: 10
|
||||||
|
type: 'int'
|
||||||
|
keycloak_quarkus_restart_health_check_reries:
|
||||||
|
description: "Number of attempts for successful health check before failing"
|
||||||
|
default: 25
|
||||||
|
type: 'int'
|
||||||
downstream:
|
downstream:
|
||||||
options:
|
options:
|
||||||
rhbk_version:
|
rhbk_version:
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
url: "{{ keycloak.health_url }}"
|
url: "{{ keycloak.health_url }}"
|
||||||
register: keycloak_status
|
register: keycloak_status
|
||||||
until: keycloak_status.status == 200
|
until: keycloak_status.status == 200
|
||||||
retries: 25
|
retries: "{{ keycloak_quarkus_restart_health_check_reries }}"
|
||||||
delay: 10
|
delay: "{{ keycloak_quarkus_restart_health_check_delay }}"
|
||||||
when: keycloak_quarkus_restart_health_check
|
when: internal_force_health_check | default(keycloak_quarkus_restart_health_check)
|
||||||
|
|
||||||
- name: Pause to give distributed ispn caches time to (re-)replicate back onto first host
|
- name: Pause to give distributed ispn caches time to (re-)replicate back onto first host
|
||||||
ansible.builtin.pause:
|
ansible.builtin.pause:
|
||||||
|
|
|
@ -1,31 +1,14 @@
|
||||||
---
|
---
|
||||||
- name: Verify first restarted service with health URL, then rest restart in parallel
|
- name: Verify first restarted service with health URL, then rest restart in parallel
|
||||||
block:
|
block:
|
||||||
- name: "Restart and enable {{ keycloak.service_name }} service on first host"
|
- name: "Restart and enable {{ keycloak.service_name }} service on initial host"
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.include_tasks:
|
||||||
name: "{{ keycloak.service_name }}"
|
file: restart.yml
|
||||||
enabled: true
|
apply:
|
||||||
state: restarted
|
delegate_to: "{{ ansible_play_hosts | first }}"
|
||||||
daemon_reload: true
|
run_once: true
|
||||||
become: true
|
vars:
|
||||||
delegate_to: "{{ ansible_play_hosts | first }}"
|
internal_force_health_check: true
|
||||||
run_once: true
|
|
||||||
|
|
||||||
- name: "Wait until {{ keycloak.service_name }} service becomes active {{ keycloak.health_url }}"
|
|
||||||
ansible.builtin.uri:
|
|
||||||
url: "{{ keycloak.health_url }}"
|
|
||||||
register: keycloak_status
|
|
||||||
until: keycloak_status.status == 200
|
|
||||||
retries: 25
|
|
||||||
delay: 10
|
|
||||||
delegate_to: "{{ ansible_play_hosts | first }}"
|
|
||||||
run_once: true
|
|
||||||
|
|
||||||
- name: Pause to give distributed ispn caches time to (re-)replicate back onto first host
|
|
||||||
ansible.builtin.pause:
|
|
||||||
seconds: "{{ keycloak_quarkus_restart_pause }}"
|
|
||||||
when:
|
|
||||||
- keycloak_quarkus_ha_enabled
|
|
||||||
|
|
||||||
- name: "Restart and enable {{ keycloak.service_name }} service on other hosts"
|
- name: "Restart and enable {{ keycloak.service_name }} service on other hosts"
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue