Skip to content

Commit

Permalink
restart handler: orchestrate
Browse files Browse the repository at this point in the history
  • Loading branch information
guidograzioli committed Sep 28, 2022
1 parent a7fbce2 commit be58217
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions roles/keycloak/tasks/restart_keycloak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,23 @@
enabled: yes
state: restarted
become: yes
delegate_to: "{{ ansible_play_hosts | first }}"
run_once: True

- name: "Wait until {{ keycloak.service_name }} becomes active {{ keycloak.health_url }}"
ansible.builtin.uri:
url: "{{ keycloak.health_url }}"
register: keycloak_status
until: keycloak_status.status == 200
delegate_to: "{{ ansible_play_hosts | first }}"
run_once: True
retries: 25
delay: 10

- name: "Restart and enable {{ keycloak.service_name }} service"
ansible.builtin.systemd:
name: keycloak
enabled: yes
state: restarted
become: yes
when: and inventory_hostname != ansible_play_hosts | first

0 comments on commit be58217

Please sign in to comment.