ansible-keycloak/roles/keycloak/tasks/systemd.yml

72 lines
1.9 KiB
YAML
Raw Normal View History

2022-03-17 09:45:55 +00:00
- name: "Configure {{ keycloak.service_name }} service script wrapper"
become: yes
2022-02-24 14:00:10 +00:00
ansible.builtin.template:
src: keycloak-service.sh.j2
dest: "{{ keycloak_dest }}/keycloak-service.sh"
owner: root
group: root
mode: 0755
notify:
- restart keycloak
- name: Determine JAVA_HOME for selected JVM RPM
shell: |
set -o pipefail
rpm -ql {{ keycloak_jvm_package }} | grep -Po '/usr/lib/jvm/.*(?=/bin/java$)'
args:
executable: /bin/bash
register: rpm_java_home
2022-03-17 09:45:55 +00:00
- name: "Configure sysconfig file for {{ keycloak.service_name }} service"
become: yes
2022-02-24 14:00:10 +00:00
ansible.builtin.template:
src: keycloak-sysconfig.j2
dest: /etc/sysconfig/keycloak
owner: root
group: root
mode: 0644
vars:
keycloak_rpm_java_home: "{{ rpm_java_home.stdout }}"
notify:
- restart keycloak
2022-03-17 09:45:55 +00:00
- name: "Configure systemd unit file for {{ keycloak.service_name }} service"
2022-02-24 14:00:10 +00:00
ansible.builtin.template:
src: keycloak.service.j2
dest: /etc/systemd/system/keycloak.service
owner: root
group: root
mode: 0644
become: yes
register: systemdunit
notify:
- restart keycloak
- name: Reload systemd
become: yes
2022-02-24 14:00:10 +00:00
ansible.builtin.systemd:
daemon_reload: yes
when: systemdunit.changed
2022-03-17 09:45:55 +00:00
- name: "Start and wait for {{ keycloak.service_name }} service (first node db)"
ansible.builtin.include_tasks: start_keycloak.yml
run_once: yes
when: keycloak_db_enabled
2022-03-17 09:45:55 +00:00
- name: "Start and wait for {{ keycloak.service_name }} service (remaining nodes)"
ansible.builtin.include_tasks: start_keycloak.yml
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"
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:
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