2022-03-08 11:08:40 +00:00
|
|
|
- name: Configure keycloak service script wrapper
|
2021-12-14 10:26:42 +00:00
|
|
|
become: yes
|
2022-02-24 14:00:10 +00:00
|
|
|
ansible.builtin.template:
|
2021-12-14 10:26:42 +00:00
|
|
|
src: keycloak-service.sh.j2
|
|
|
|
dest: "{{ keycloak_dest }}/keycloak-service.sh"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
|
|
|
notify:
|
|
|
|
- restart keycloak
|
|
|
|
|
2022-03-08 11:08:40 +00:00
|
|
|
- name: Configure sysconfig file for keycloak service
|
2021-12-14 10:26:42 +00:00
|
|
|
become: yes
|
2022-02-24 14:00:10 +00:00
|
|
|
ansible.builtin.template:
|
2021-12-14 10:26:42 +00:00
|
|
|
src: keycloak-sysconfig.j2
|
|
|
|
dest: /etc/sysconfig/keycloak
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify:
|
|
|
|
- restart keycloak
|
|
|
|
|
2022-03-08 11:08:40 +00:00
|
|
|
- name: Configure systemd unit file for keycloak service
|
2022-02-24 14:00:10 +00:00
|
|
|
ansible.builtin.template:
|
2021-12-14 10:26:42 +00:00
|
|
|
src: keycloak.service.j2
|
|
|
|
dest: /etc/systemd/system/keycloak.service
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
become: yes
|
|
|
|
register: systemdunit
|
|
|
|
notify:
|
|
|
|
- restart keycloak
|
|
|
|
|
2022-03-08 11:08:40 +00:00
|
|
|
- name: Reload systemd
|
2021-12-14 10:26:42 +00:00
|
|
|
become: yes
|
2022-02-24 14:00:10 +00:00
|
|
|
ansible.builtin.systemd:
|
2021-12-14 10:26:42 +00:00
|
|
|
daemon_reload: yes
|
|
|
|
when: systemdunit.changed
|
|
|
|
|
2022-03-08 11:08:40 +00:00
|
|
|
- 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
|
2021-12-14 10:26:42 +00:00
|
|
|
|
2022-01-27 13:23:11 +00:00
|
|
|
- name: Check service status
|
2022-02-24 14:00:10 +00:00
|
|
|
ansible.builtin.command: "systemctl status keycloak"
|
2021-12-14 10:26:42 +00:00
|
|
|
register: keycloak_service_status
|
|
|
|
changed_when: False
|
|
|
|
|
2022-01-27 13:23:11 +00:00
|
|
|
- name: Verify service status
|
2022-02-24 14:00:10 +00:00
|
|
|
ansible.builtin.assert:
|
2021-12-14 10:26:42 +00:00
|
|
|
that:
|
|
|
|
- keycloak_service_status is defined
|
|
|
|
- keycloak_service_status.stdout is defined
|
|
|
|
|
2022-02-15 12:14:36 +00:00
|
|
|
- name: Flush handlers
|
2022-02-24 14:00:10 +00:00
|
|
|
ansible.builtin.meta: flush_handlers
|