From 8173be4b58b548ba71dcda1ee87f1b2496865b7d Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Thu, 24 Mar 2022 17:00:30 +0100 Subject: [PATCH] Set the frontend URL to play well with other defaults --- roles/keycloak/README.md | 6 +++--- roles/keycloak/defaults/main.yml | 6 ++++-- roles/keycloak/handlers/main.yml | 3 ++- roles/keycloak/meta/argument_specs.yml | 2 +- roles/keycloak/tasks/prereqs.yml | 2 +- roles/keycloak/templates/keycloak.service.j2 | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/roles/keycloak/README.md b/roles/keycloak/README.md index a1295f1..73d6b26 100644 --- a/roles/keycloak/README.md +++ b/roles/keycloak/README.md @@ -66,7 +66,7 @@ Role Defaults |`keycloak_service_user`| posix account username | `keycloak` | |`keycloak_service_group`| posix account group | `keycloak` | |`keycloak_service_pidfile`| pid file path for service | `/run/keycloak.pid` | -|`jvm_package`| RHEL java package runtime | `java-1.8.0-openjdk-devel` | +|`keycloak_jvm_package`| RHEL java package runtime | `java-1.8.0-openjdk-devel` | * Install options @@ -115,6 +115,7 @@ The following are a set of _required_ variables for the role: | Variable | Description | |:---------|:------------| |`keycloak_admin_password`| Password for the administration console user account | +|`keycloak_frontend_url` | frontend URL for keycloak endpoint | `http://localhost:8080/auth` | The following variables are _required_ only when `keycloak_ha_enabled` is True: @@ -122,8 +123,7 @@ The following variables are _required_ only when `keycloak_ha_enabled` is True: | Variable | Description | Default | |:---------|:------------|:---------| |`keycloak_modcluster_url` | URL for the modcluster reverse proxy | `localhost` | -|`keycloak_frontend_url` | frontend URL for keycloak endpoints when a reverse proxy is used | `http://localhost` | -|`keycloak_jdbc_engine` | backend database flavour when db is enabled: [ postgres, mariadb ] | `postgres` | +|`keycloak_jdbc_engine` | backend database engine when db is enabled: [ postgres, mariadb ] | `postgres` | |`infinispan_url` | URL for the infinispan remote-cache server | `localhost:11122` | |`infinispan_user` | username for connecting to infinispan | `supervisor` | |`infinispan_pass` | password for connecting to infinispan | `supervisor` | diff --git a/roles/keycloak/defaults/main.yml b/roles/keycloak/defaults/main.yml index ebbaa05..aa62b06 100644 --- a/roles/keycloak/defaults/main.yml +++ b/roles/keycloak/defaults/main.yml @@ -21,7 +21,7 @@ keycloak_rhsso_enable: "{{ True if rhsso_rhn_id is defined and rhn_username is d keycloak_offline_install: False ### Install location and service settings -jvm_package: java-1.8.0-openjdk-devel +keycloak_jvm_package: java-1.8.0-openjdk-devel keycloak_dest: /opt/keycloak keycloak_jboss_home: "{{ keycloak_rhsso_installdir if keycloak_rhsso_enable else keycloak_installdir }}" keycloak_config_dir: "{{ keycloak_jboss_home }}/standalone/configuration" @@ -58,7 +58,9 @@ keycloak_force_install: False ### mod_cluster reverse proxy keycloak_modcluster_url: localhost -keycloak_frontend_url: http://localhost + +### keycloak frontend url +keycloak_frontend_url: http://localhost:8080/auth ### infinispan remote caches access (hotrod) infinispan_user: supervisor diff --git a/roles/keycloak/handlers/main.yml b/roles/keycloak/handlers/main.yml index 1727b6d..dda3682 100644 --- a/roles/keycloak/handlers/main.yml +++ b/roles/keycloak/handlers/main.yml @@ -1,3 +1,4 @@ --- -- name: restart keycloak +- name: "Restart {{ keycloak.service_name }}" ansible.builtin.include_tasks: restart_keycloak.yml + listen: "restart keycloak" diff --git a/roles/keycloak/meta/argument_specs.yml b/roles/keycloak/meta/argument_specs.yml index bd3313a..ba2ecdd 100644 --- a/roles/keycloak/meta/argument_specs.yml +++ b/roles/keycloak/meta/argument_specs.yml @@ -76,7 +76,7 @@ argument_specs: default: false description: "Perform an offline install" type: "bool" - jvm_package: + keycloak_jvm_package: # line 23 of keycloak/defaults/main.yml default: "java-1.8.0-openjdk-devel" description: "RHEL java package runtime rpm" diff --git a/roles/keycloak/tasks/prereqs.yml b/roles/keycloak/tasks/prereqs.yml index 77e8364..6d3fc33 100644 --- a/roles/keycloak/tasks/prereqs.yml +++ b/roles/keycloak/tasks/prereqs.yml @@ -20,7 +20,7 @@ ansible.builtin.include_tasks: fastpackages.yml vars: packages_list: - - "{{ jvm_package }}" + - "{{ keycloak_jvm_package }}" - unzip - procps-ng - initscripts \ No newline at end of file diff --git a/roles/keycloak/templates/keycloak.service.j2 b/roles/keycloak/templates/keycloak.service.j2 index e7233f2..0fcecbf 100644 --- a/roles/keycloak/templates/keycloak.service.j2 +++ b/roles/keycloak/templates/keycloak.service.j2 @@ -1,6 +1,6 @@ # {{ ansible_managed }} [Unit] -Description=Keycloak Server +Description={{ keycloak.service_name }} Server After=network.target [Service]