mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2026-11-26 02:43:46 +00:00
AMW-641 Fix health check URL to use localhost instead of public hostname
Replace hostname-based health check URL with localhost. The health check runs on the managed host itself, so it should always target localhost rather than the public-facing keycloak_quarkus_hostname which can be empty or a domain name behind a load balancer. Compose the URL directly from existing production variables (keycloak_quarkus_http_enabled, keycloak_quarkus_http_port, keycloak_quarkus_https_port, keycloak_quarkus_http_relative_path) without introducing intermediate variables. Add .config/molecule/config.yml with shared molecule settings and a new quarkus_nohost test scenario that verifies the role works when keycloak_quarkus_hostname is left at its default empty value. Fixes #428
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user