use proper service name in task names
parent
33e80a0cd4
commit
e773e12e24
|
@ -1,11 +1,9 @@
|
||||||
---
|
---
|
||||||
- name: Playbook for Keycloak Hosts
|
- name: Playbook for Keycloak Hosts
|
||||||
hosts: keycloak
|
hosts: keycloak
|
||||||
collections:
|
|
||||||
- middleware_automation.keycloak
|
|
||||||
tasks:
|
|
||||||
- name: Include keycloak role
|
|
||||||
ansible.builtin.include_role:
|
|
||||||
name: middleware_automation.keycloak.keycloak
|
|
||||||
vars:
|
vars:
|
||||||
keycloak_admin_password: "changeme"
|
keycloak_admin_password: "changeme"
|
||||||
|
collections:
|
||||||
|
- middleware_automation.keycloak
|
||||||
|
roles:
|
||||||
|
- middleware_automation.keycloak.keycloak
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
---
|
---
|
||||||
- name: Playbook for Keycloak Hosts
|
- name: Playbook for Keycloak Hosts
|
||||||
hosts: keycloak
|
hosts: keycloak
|
||||||
collections:
|
|
||||||
- middleware_automation.redhat_csp_download
|
|
||||||
roles:
|
|
||||||
- middleware_automation.redhat_csp_download.redhat_csp_download
|
|
||||||
tasks:
|
|
||||||
- name: Keycloak Role
|
|
||||||
ansible.builtin.include_role:
|
|
||||||
name: middleware_automation.keycloak.keycloak
|
|
||||||
vars:
|
vars:
|
||||||
keycloak_admin_password: "changeme"
|
keycloak_admin_password: "changeme"
|
||||||
keycloak_rhsso_enable: True
|
keycloak_rhsso_enable: True
|
||||||
|
collections:
|
||||||
|
- middleware_automation.redhat_csp_download
|
||||||
|
- middleware_automation.keycloak
|
||||||
|
roles:
|
||||||
|
- middleware_automation.redhat_csp_download.redhat_csp_download
|
||||||
|
- middleware_automation.keycloak.keycloak
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
enabled: yes
|
enabled: yes
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: Configure firewall for keycloak ports
|
- name: "Configure firewall for {{ keycloak.service_name }} ports"
|
||||||
become: yes
|
become: yes
|
||||||
firewalld:
|
firewalld:
|
||||||
port: "{{ item }}"
|
port: "{{ item }}"
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
register: existing_deploy
|
register: existing_deploy
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Stop the old keycloak service
|
- name: "Stop the old {{ keycloak.service_name }} service"
|
||||||
become: yes
|
become: yes
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: keycloak
|
name: keycloak
|
||||||
state: stopped
|
state: stopped
|
||||||
- name: Remove the old Keycloak deployment
|
- name: "Remove the old {{ keycloak.service_name }} deployment"
|
||||||
become: yes
|
become: yes
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ keycloak_jboss_home }}"
|
path: "{{ keycloak_jboss_home }}"
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ keycloak_jboss_home }}"
|
path: "{{ keycloak_jboss_home }}"
|
||||||
|
|
||||||
- name: Create Keycloak service user/group
|
- name: "Create {{ keycloak.service_name }} service user/group"
|
||||||
become: yes
|
become: yes
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ keycloak_service_user }}"
|
name: "{{ keycloak_service_user }}"
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
system: yes
|
system: yes
|
||||||
create_home: no
|
create_home: no
|
||||||
|
|
||||||
- name: Create Keycloak install location
|
- name: "Create {{ keycloak.service_name }} install location"
|
||||||
become: yes
|
become: yes
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
dest: "{{ keycloak_dest }}"
|
dest: "{{ keycloak_dest }}"
|
||||||
|
@ -58,6 +58,7 @@
|
||||||
archive: "{{ keycloak_dest }}/{{ keycloak.bundle }}"
|
archive: "{{ keycloak_dest }}/{{ keycloak.bundle }}"
|
||||||
|
|
||||||
- name: Check download archive path
|
- name: Check download archive path
|
||||||
|
become: yes
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ archive }}"
|
path: "{{ archive }}"
|
||||||
register: archive_path
|
register: archive_path
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
dest: /var/log/keycloak
|
dest: /var/log/keycloak
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Check admin credentials by generating a token
|
- name: Check admin credentials by generating a token (supposed to fail on first installation)
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "{{ keycloak_url }}/auth/realms/master/protocol/openid-connect/token"
|
url: "{{ keycloak_url }}/auth/realms/master/protocol/openid-connect/token"
|
||||||
method: POST
|
method: POST
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: "Restart and enable keycloack service"
|
- name: "Restart and enable {{ keycloak.service_name }} service"
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: keycloak
|
name: keycloak
|
||||||
enabled: yes
|
enabled: yes
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
when:
|
when:
|
||||||
- cli_result.rc == 0
|
- cli_result.rc == 0
|
||||||
|
|
||||||
- name: "Wait until Keycloak becomes active {{ keycloak.health_url }}"
|
- name: "Wait until {{ keycloak.service_name }} becomes active {{ keycloak.health_url }}"
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "{{ keycloak.health_url }}"
|
url: "{{ keycloak.health_url }}"
|
||||||
register: keycloak_status
|
register: keycloak_status
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
---
|
---
|
||||||
- name: Start keycloak
|
- name: "Start {{ keycloak.service_name }} service"
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: keycloak
|
name: keycloak
|
||||||
enabled: yes
|
enabled: yes
|
||||||
state: started
|
state: started
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
- name: "Wait until Keycloak becomes active {{ keycloak.health_url }}"
|
- name: "Wait until {{ keycloak.service_name }} becomes active {{ keycloak.health_url }}"
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "{{ keycloak.health_url }}"
|
url: "{{ keycloak.health_url }}"
|
||||||
register: keycloak_status
|
register: keycloak_status
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: Stop keycloak
|
- name: "Stop {{ keycloak.service_name }}"
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: keycloak
|
name: keycloak
|
||||||
enabled: yes
|
enabled: yes
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Configure keycloak service script wrapper
|
- name: "Configure {{ keycloak.service_name }} service script wrapper"
|
||||||
become: yes
|
become: yes
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: keycloak-service.sh.j2
|
src: keycloak-service.sh.j2
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
notify:
|
notify:
|
||||||
- restart keycloak
|
- restart keycloak
|
||||||
|
|
||||||
- name: Configure sysconfig file for keycloak service
|
- name: "Configure sysconfig file for {{ keycloak.service_name }} service"
|
||||||
become: yes
|
become: yes
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: keycloak-sysconfig.j2
|
src: keycloak-sysconfig.j2
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
notify:
|
notify:
|
||||||
- restart keycloak
|
- restart keycloak
|
||||||
|
|
||||||
- name: Configure systemd unit file for keycloak service
|
- name: "Configure systemd unit file for {{ keycloak.service_name }} service"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: keycloak.service.j2
|
src: keycloak.service.j2
|
||||||
dest: /etc/systemd/system/keycloak.service
|
dest: /etc/systemd/system/keycloak.service
|
||||||
|
@ -38,12 +38,12 @@
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
when: systemdunit.changed
|
when: systemdunit.changed
|
||||||
|
|
||||||
- name: Start and wait for keycloak service (first node db)
|
- name: "Start and wait for {{ keycloak.service_name }} service (first node db)"
|
||||||
ansible.builtin.include_tasks: start_keycloak.yml
|
ansible.builtin.include_tasks: start_keycloak.yml
|
||||||
run_once: yes
|
run_once: yes
|
||||||
when: keycloak_db_enabled
|
when: keycloak_db_enabled
|
||||||
|
|
||||||
- name: Start and wait for keycloak service (remaining nodes)
|
- name: "Start and wait for {{ keycloak.service_name }} service (remaining nodes)"
|
||||||
ansible.builtin.include_tasks: start_keycloak.yml
|
ansible.builtin.include_tasks: start_keycloak.yml
|
||||||
|
|
||||||
- name: Check service status
|
- name: Check service status
|
||||||
|
|
Loading…
Reference in New Issue