ansible-middleware/keycloak

Service configuration needs to be updated for newer versions of Keycloak

Closed this issue · 5 comments

SUMMARY

The scripts created by the role to start Keycloak as a service still refer to standalone.sh rather than kc.sh

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible [core 2.11.12]
  config file = /home/crm194/src/gitlab.com/bmrc/ceph/keycloak/ansible/ansible.cfg
  configured module search path = ['/home/crm194/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/crm194/venvs/ansible-keycloak/lib64/python3.6/site-packages/ansible
  ansible collection location = /home/crm194/src/gitlab.com/bmrc/ceph/keycloak/ansible
  executable location = /home/crm194/venvs/ansible-keycloak/bin/ansible
  python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
Collection                                Version
----------------------------------------- -------
ansible.posix                             1.5.1
community.general                         6.4.0
community.hashi_vault                     4.1.0
middleware_automation.keycloak            1.1.0
middleware_automation.redhat_csp_download 1.2.2
STEPS TO REPRODUCE

ansible-playbook -v playbooks/install_keycloak.yml

---
- name: Playbook for Keycloak Hosts
  hosts: <host group>
  collections:
    - middleware_automation.keycloak
  roles:
    - keycloak
EXPECTED RESULTS

Keycloak starts after installation and service configuration

ACTUAL RESULTS
 sudo systemctl status keycloak
● keycloak.service - keycloak Server
   Loaded: loaded (/etc/systemd/system/keycloak.service; enabled; vendor preset: disabled)
   Active: failed (Result: timeout) since Thu 2023-03-02 17:12:00 UTC; 10min ago
  Process: 160751 ExecStart=/opt/keycloak/keycloak-service.sh start (code=killed, signal=TERM)

Mar 02 17:11:30 <hostname> systemd[1]: Starting keycloak Server...
Mar 02 17:11:30 <hostname> keycloak-service.sh[160754]: /opt/keycloak/keycloak-service.sh: line 77: /opt/keycloak/keycloak-21.0.1/bin/standalone.sh: No such file or directory
Mar 02 17:12:00 <hostname> systemd[1]: keycloak.service: start operation timed out. Terminating.
Mar 02 17:12:00 <hostname> systemd[1]: keycloak.service: Failed with result 'timeout'.
Mar 02 17:12:00 <hostname>systemd[1]: Failed to start keycloak Server.

If I edit /opt/keycloak/keycloak-service.sh to point to kc.sh, I see another error after trying to start the service:

Mar 02 17:25:57 <hostname> keycloak-service.sh[162208]: JAVA_OPTS already set in environment; overriding default settings with values: -Xms1024m -Xmx2048m
Mar 02 17:25:57 <hostname> keycloak-service.sh[162217]: Unrecognized option: --add-opens=java.base/java.util=ALL-UNNAMED
Mar 02 17:25:57 <hostname> keycloak-service.sh[162217]: Error: Could not create the Java Virtual Machine.
Mar 02 17:25:57 <hostname> keycloak-service.sh[162217]: Error: A fatal exception has occurred. Program will exit.
Mar 02 17:26:27 <hostname> systemd[1]: keycloak.service: start operation timed out. Terminating.
Mar 02 17:26:27 <hostname> systemd[1]: keycloak.service: Failed with result 'timeout'.

This is with Keycloak 21.0.1 on a CentOS 8 Stream host.

Hello, thanks for reporting; are you trying to install the quarkus release of keycloak? In that case, you should call the keycloak_quarkus role; the keycloak role is meant to be used for wildfly(legacy) keycloak releases

Ah, sorry - will give that a try.
In a hurry to get this working, so I must have missed this in the docs.

... and the docs need some love indeed

Just to say I've switched to the correct role, and that has worked.
Thanks for the swift response.