mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2025-08-06 22:24:30 -07:00
Replace use of serial with run_once
run_once on first node when database config enabled (so the first node creates the tables), then wakeup all other nodes
This commit is contained in:
parent
0bc81cc781
commit
b88c43933c
5 changed files with 30 additions and 24 deletions
|
@ -7,10 +7,10 @@
|
|||
- prereqs
|
||||
|
||||
- name: Include install tasks
|
||||
ansible.builtin.include_tasks: tasks/install.yml
|
||||
ansible.builtin.include_tasks: install.yml
|
||||
|
||||
- name: Include systemd tasks
|
||||
ansible.builtin.include_tasks: tasks/systemd.yml
|
||||
ansible.builtin.include_tasks: systemd.yml
|
||||
|
||||
- name: Link default logs directory
|
||||
ansible.builtin.file:
|
||||
|
|
15
roles/keycloak/tasks/start_keycloak.yml
Normal file
15
roles/keycloak/tasks/start_keycloak.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: start keycloak
|
||||
ansible.builtin.systemd:
|
||||
name: keycloak
|
||||
enabled: yes
|
||||
state: started
|
||||
become: yes
|
||||
|
||||
- name: "Wait until Keycloak becomes active {{ keycloak.health_url }}"
|
||||
ansible.builtin.uri:
|
||||
url: "{{ keycloak.health_url }}"
|
||||
register: keycloak_status
|
||||
until: keycloak_status.status == 200
|
||||
retries: 25
|
||||
delay: 10
|
|
@ -1,4 +1,4 @@
|
|||
- name: configure keycloak service script wrapper
|
||||
- name: Configure keycloak service script wrapper
|
||||
become: yes
|
||||
ansible.builtin.template:
|
||||
src: keycloak-service.sh.j2
|
||||
|
@ -9,7 +9,7 @@
|
|||
notify:
|
||||
- restart keycloak
|
||||
|
||||
- name: configure sysconfig file for keycloak service
|
||||
- name: Configure sysconfig file for keycloak service
|
||||
become: yes
|
||||
ansible.builtin.template:
|
||||
src: keycloak-sysconfig.j2
|
||||
|
@ -20,7 +20,7 @@
|
|||
notify:
|
||||
- restart keycloak
|
||||
|
||||
- name: configure systemd unit file for keycloak service
|
||||
- name: Configure systemd unit file for keycloak service
|
||||
ansible.builtin.template:
|
||||
src: keycloak.service.j2
|
||||
dest: /etc/systemd/system/keycloak.service
|
||||
|
@ -32,18 +32,19 @@
|
|||
notify:
|
||||
- restart keycloak
|
||||
|
||||
- name: reload systemd
|
||||
- name: Reload systemd
|
||||
become: yes
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: yes
|
||||
when: systemdunit.changed
|
||||
|
||||
- name: start keycloak
|
||||
ansible.builtin.systemd:
|
||||
name: keycloak
|
||||
enabled: yes
|
||||
state: started
|
||||
become: yes
|
||||
- name: Start and wait for keycloak service (first node db)
|
||||
ansible.builtin.include_tasks: start_keycloak.yml
|
||||
run_once: yes
|
||||
when: keycloak_db_enabled
|
||||
|
||||
- name: Start and wait for keycloak service (remaining nodes)
|
||||
ansible.builtin.include_tasks: start_keycloak.yml
|
||||
|
||||
- name: Check service status
|
||||
ansible.builtin.command: "systemctl status keycloak"
|
||||
|
@ -58,11 +59,3 @@
|
|||
|
||||
- name: Flush handlers
|
||||
ansible.builtin.meta: flush_handlers
|
||||
|
||||
- name: "Wait until Keycloak becomes active {{ keycloak.health_url }}"
|
||||
ansible.builtin.uri:
|
||||
url: "{{ keycloak.health_url }}"
|
||||
register: keycloak_status
|
||||
until: keycloak_status.status == 200
|
||||
retries: 25
|
||||
delay: 10
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue