Merge pull request #429 from cihlamar/AMW-641

Fix health check URL to use localhost with protocol and port
This commit is contained in:
Harsha Cherukuri
2026-10-05 19:22:06 -04:00
committed by GitHub
8 changed files with 108 additions and 7 deletions
+1 -1
View File
@@ -34,4 +34,4 @@ jobs:
root_permission_varname: 'keycloak_install_requires_become'
debug_verbosity: "${{ github.event.inputs.debug_verbosity }}"
molecule_tests: >-
[ "debian", "sso_test", "quarkus", "quarkus_ha", "quarkus_ha_remote", "quarkus_ha_26.4_below", "default", "quarkus_devmode", "quarkus_upgrade", "keycloak_modules", "quarkus_relpath" ]
[ "debian", "sso_test", "quarkus", "quarkus_ha", "quarkus_ha_remote", "quarkus_ha_26.4_below", "default", "quarkus_devmode", "quarkus_upgrade", "keycloak_modules", "quarkus_relpath", "quarkus_nohost" ]
+18
View File
@@ -0,0 +1,18 @@
---
- name: Converge
hosts: all
vars_files:
- ../group_vars/all/vars.yml
vars:
keycloak_quarkus_show_deprecation_warnings: false
keycloak_quarkus_bootstrap_admin_password: "remembertochangeme"
keycloak_quarkus_bootstrap_admin_user: "remembertochangeme"
keycloak_quarkus_log: file
keycloak_quarkus_start_dev: true
keycloak_quarkus_hostname_strict: false
keycloak_quarkus_proxy_mode: none
keycloak_quarkus_offline_install: true
keycloak_quarkus_download_path: /tmp/keycloak/
keycloak_quarkus_java_heap_opts: "-Xms640m -Xmx640m"
roles:
- role: keycloak_quarkus
+49
View File
@@ -0,0 +1,49 @@
---
driver:
name: docker
platforms:
- name: instance
image: registry.access.redhat.com/ubi9/ubi-init:latest
pre_build_image: true
privileged: true
command: "/usr/sbin/init"
exposed_ports:
- "8080/tcp"
- "8443/tcp"
- "8009/tcp"
- "9000/tcp"
provisioner:
name: ansible
config_options:
defaults:
interpreter_python: auto_silent
ssh_connection:
pipelining: false
playbooks:
prepare: ../default/prepare.yml
inventory:
host_vars:
localhost:
ansible_python_interpreter: "{{ ansible_playbook_python }}"
env:
ANSIBLE_FORCE_COLOR: "true"
PROXY: "${PROXY}"
NO_PROXY: "${NO_PROXY}"
verifier:
name: ansible
scenario:
test_sequence:
- cleanup
- destroy
- create
- prepare
- converge
- idempotence
- side_effect
- verify
- cleanup
- destroy
+22
View File
@@ -0,0 +1,22 @@
---
- name: Verify
hosts: all
tasks:
- name: Populate service facts
ansible.builtin.service_facts:
- name: Check if keycloak service started
ansible.builtin.assert:
that:
- ansible_facts.services["keycloak.service"]["state"] == "running"
- ansible_facts.services["keycloak.service"]["status"] == "enabled"
- name: Verify health check endpoint is reachable on localhost
ansible.builtin.uri:
url: "http://localhost:8080/realms/master/.well-known/openid-configuration"
method: GET
validate_certs: false
register: keycloak_health_response
until: keycloak_health_response.status == 200
retries: 5
delay: 5
+2 -2
View File
@@ -65,8 +65,8 @@ Role Defaults
|`keycloak_quarkus_additional_env_vars` | List of additional env variables of { key: str, value: str} to be put in sysconfig file, see https://www.keycloak.org/server/all-config | `[]` |
|`keycloak_quarkus_frontend_url`| Deprecated, use `keycloak_quarkus_hostname` instead. | |
|`keycloak_quarkus_admin_url`| Deprecated, use `keycloak_quarkus_hostname_admin` instead. | |
|`keycloak_quarkus_health_check_url`| Full URL (including scheme, host, path, fragment etc.) used for health check endpoint; keycloak_quarkus_hostname will NOT be prepended; helpful when health checks should happen against http port, but keycloak_quarkus_hostname uses https scheme per default | `{{ keycloak_quarkus_hostname ~ keycloak_quarkus_http_relative_path.rstrip('/') ~ '/' ~ keycloak_quarkus_health_check_url_path }}` |
|`keycloak_quarkus_health_check_url_path`| Path to the health check endpoint; keycloak_quarkus_hostname will be prepended automatically; Note that keycloak_quarkus_health_check_url takes precedence over this property | `realms/{{ keycloak_quarkus_master_realm }}/.well-known/openid-configuration` |
|`keycloak_quarkus_health_check_url`| Full URL for the health check endpoint, targets localhost | Composed from `keycloak_quarkus_http_enabled`, `keycloak_quarkus_http_port`/`keycloak_quarkus_https_port`, and `keycloak_quarkus_http_relative_path` |
|`keycloak_quarkus_health_check_url_path`| Path appended to the health check URL | `realms/{{ keycloak_quarkus_master_realm }}/.well-known/openid-configuration` |
|`keycloak_quarkus_proxy_headers`| Parse reverse proxy headers (`forwarded` or `xforwarded`) | `""` |
|`keycloak_quarkus_config_key_store_file`| Path to the configuration key store; only used if `keycloak_quarkus_config_key_store_password` is not empty | `{{ keycloak.home }}/conf/conf_store.p12` if `keycloak_quarkus_config_key_store_password != ''`, else `''` |
|`keycloak_quarkus_config_key_store_password`| Password of the configuration keystore; if non-empty, `keycloak_quarkus_db_pass` will be saved to the keystore at `keycloak_quarkus_config_key_store_file` instead of being written to the configuration file in clear text | `""` |
+4 -1
View File
@@ -190,7 +190,10 @@ keycloak_quarkus_restart_health_check_delay: 10
keycloak_quarkus_restart_health_check_retries: 25
keycloak_quarkus_validate_certs: true
keycloak_quarkus_health_check_url_path: "realms/{{ keycloak_quarkus_master_realm }}/.well-known/openid-configuration"
keycloak_quarkus_health_check_url: "{{ keycloak_quarkus_hostname.rstrip('/').removesuffix(keycloak_quarkus_http_relative_path.rstrip('/')) ~ keycloak_quarkus_http_relative_path.rstrip('/') ~ '/' ~ keycloak_quarkus_health_check_url_path }}"
keycloak_quarkus_health_check_url: >-
{{ 'http' if keycloak_quarkus_http_enabled else 'https' }}://localhost:{{
keycloak_quarkus_http_port if keycloak_quarkus_http_enabled else keycloak_quarkus_https_port }}{{
keycloak_quarkus_http_relative_path.rstrip('/') }}/{{ keycloak_quarkus_health_check_url_path }}
keycloak_quarkus_restart_pause: 15
keycloak_quarkus_force_install: false
@@ -116,12 +116,17 @@ argument_specs:
description: "HTTP port"
type: "int"
keycloak_quarkus_health_check_url:
default: "{{ keycloak_quarkus_hostname.rstrip('/').removesuffix(keycloak_quarkus_http_relative_path.rstrip('/')) ~ keycloak_quarkus_http_relative_path.rstrip('/') ~ '/' ~ keycloak_quarkus_health_check_url_path }}"
description: "Full URL (including scheme, host, path, fragment etc.) used for health check endpoint; keycloak_quarkus_hostname will NOT be prepended; helpful when health checks should happen against http port, but keycloak_quarkus_hostname uses https scheme per default"
default: >-
{{ 'http' if keycloak_quarkus_http_enabled else 'https' }}://localhost:{{
keycloak_quarkus_http_port if keycloak_quarkus_http_enabled else keycloak_quarkus_https_port }}{{
keycloak_quarkus_http_relative_path.rstrip('/') }}/{{ keycloak_quarkus_health_check_url_path }}
description: >-
Full URL for the health check endpoint, targets localhost since
the check runs on the managed host itself
type: "str"
keycloak_quarkus_health_check_url_path:
default: "realms/{{ keycloak_quarkus_master_realm }}/.well-known/openid-configuration"
description: "Path to the health check endpoint; keycloak_quarkus_hostname will be prepended automatically; Note that keycloak_quarkus_health_check_url takes precedence over this property"
description: "Path appended to the health check URL"
type: "str"
keycloak_quarkus_https_key_file_enabled:
default: false
@@ -50,8 +50,12 @@ https-trust-store-password={{ keycloak_quarkus_https_trust_store_password }}
{% endif %}
# Client URL configuration
{% if keycloak_quarkus_hostname | length > 0 %}
hostname={{ keycloak_quarkus_hostname }}
{% endif %}
{% if keycloak_quarkus_hostname_admin | length > 0 %}
hostname-admin={{ keycloak_quarkus_hostname_admin }}
{% endif %}
hostname-strict={{ keycloak_quarkus_hostname_strict | lower }}
hostname-backchannel-dynamic={{ keycloak_quarkus_hostname_backchannel_dynamic | lower }}