mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2025-04-05 10:20:27 -07:00
add variable for force_frontend_url
This commit is contained in:
parent
98e1633c43
commit
c4b4be3c3b
12 changed files with 17 additions and 83 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,6 +2,8 @@
|
||||||
*.zip
|
*.zip
|
||||||
.tmp
|
.tmp
|
||||||
.cache
|
.cache
|
||||||
|
.vscode/
|
||||||
|
__pycache__/
|
||||||
docs/plugins/
|
docs/plugins/
|
||||||
docs/roles/
|
docs/roles/
|
||||||
docs/_build/
|
docs/_build/
|
||||||
|
|
|
@ -25,7 +25,7 @@ tags:
|
||||||
- middleware
|
- middleware
|
||||||
- a4mw
|
- a4mw
|
||||||
dependencies:
|
dependencies:
|
||||||
"middleware_automation.common": ">=1.0.0"
|
"middleware_automation.common": ">=1.1.0"
|
||||||
"ansible.posix": ">=1.4.0"
|
"ansible.posix": ">=1.4.0"
|
||||||
repository: https://github.com/ansible-middleware/keycloak
|
repository: https://github.com/ansible-middleware/keycloak
|
||||||
documentation: https://ansible-middleware.github.io/keycloak
|
documentation: https://ansible-middleware.github.io/keycloak
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (C) 2021 Eric Lavarde <elavarde@redhat.com>
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
name: version_sort
|
|
||||||
short_description: Sort a list according to version order instead of pure alphabetical one
|
|
||||||
version_added: 2.2.0
|
|
||||||
author: Eric L. (@ericzolf)
|
|
||||||
description:
|
|
||||||
- Sort a list according to version order instead of pure alphabetical one.
|
|
||||||
options:
|
|
||||||
_input:
|
|
||||||
description: A list of strings to sort.
|
|
||||||
type: list
|
|
||||||
elements: string
|
|
||||||
required: true
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
- name: Convert list of tuples into dictionary
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
dictionary: "{{ ['2.1', '2.10', '2.9'] | middleware_automation.keycloak.version_sort }}"
|
|
||||||
# Result is ['2.1', '2.9', '2.10']
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
_value:
|
|
||||||
description: The list of strings sorted by version.
|
|
||||||
type: list
|
|
||||||
elements: string
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible_collections.middleware_automation.keycloak.plugins.module_utils.version import LooseVersion
|
|
||||||
|
|
||||||
|
|
||||||
def version_sort(value, reverse=False):
|
|
||||||
'''Sort a list according to loose versions so that e.g. 2.9 is smaller than 2.10'''
|
|
||||||
return sorted(value, key=LooseVersion, reverse=reverse)
|
|
||||||
|
|
||||||
|
|
||||||
class FilterModule(object):
|
|
||||||
''' Version sort filter '''
|
|
||||||
|
|
||||||
def filters(self):
|
|
||||||
return {
|
|
||||||
'version_sort': version_sort
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# Copyright (c) 2021, Felix Fontein <felix@fontein.de>
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
"""Provide version object to compare version numbers."""
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.six import raise_from
|
|
||||||
|
|
||||||
try:
|
|
||||||
from ansible.module_utils.compat.version import LooseVersion # noqa: F401, pylint: disable=unused-import
|
|
||||||
except ImportError:
|
|
||||||
try:
|
|
||||||
from distutils.version import LooseVersion # noqa: F401, pylint: disable=unused-import
|
|
||||||
except ImportError as exc:
|
|
||||||
msg = 'To use this plugin or module with ansible-core 2.11, you need to use Python < 3.12 with distutils.version present'
|
|
||||||
raise_from(ImportError(msg), exc)
|
|
|
@ -73,9 +73,9 @@ Role Defaults
|
||||||
|`keycloak_service_user`| posix account username | `keycloak` |
|
|`keycloak_service_user`| posix account username | `keycloak` |
|
||||||
|`keycloak_service_group`| posix account group | `keycloak` |
|
|`keycloak_service_group`| posix account group | `keycloak` |
|
||||||
|`keycloak_service_restart_on_failure`| systemd restart-on-failure behavior activation |True
|
|`keycloak_service_restart_on_failure`| systemd restart-on-failure behavior activation |True
|
||||||
|`keycloak_service_startlimitintervalsec`| systemd StartLimitIntervalSec | `300` if `keycloak_service_restart_on_failure` else ``
|
|`keycloak_service_startlimitintervalsec`| systemd StartLimitIntervalSec | `300` if `keycloak_service_restart_on_failure` else `` |
|
||||||
|`keycloak_service_startlimitburst`| systemd StartLimitBurst | `5` if `keycloak_service_restart_on_failure` else ``
|
|`keycloak_service_startlimitburst`| systemd StartLimitBurst | `5` if `keycloak_service_restart_on_failure` else `` |
|
||||||
|`keycloak_service_restartsec`| systemd RestartSec | `10s` if `keycloak_service_restart_on_failure` else ``
|
|`keycloak_service_restartsec`| systemd RestartSec | `10s` if `keycloak_service_restart_on_failure` else `` |
|
||||||
|`keycloak_service_pidfile`| pid file path for service | `/run/keycloak.pid` |
|
|`keycloak_service_pidfile`| pid file path for service | `/run/keycloak.pid` |
|
||||||
|`keycloak_jvm_package`| RHEL java package runtime | `java-1.8.0-openjdk-headless` |
|
|`keycloak_jvm_package`| RHEL java package runtime | `java-1.8.0-openjdk-headless` |
|
||||||
|`keycloak_java_home`| JAVA_HOME of installed JRE, leave empty for using specified keycloak_jvm_package RPM path | `None` |
|
|`keycloak_java_home`| JAVA_HOME of installed JRE, leave empty for using specified keycloak_jvm_package RPM path | `None` |
|
||||||
|
@ -110,7 +110,7 @@ Role Defaults
|
||||||
|`keycloak_force_install` | Remove pre-existing versions of service | `False` |
|
|`keycloak_force_install` | Remove pre-existing versions of service | `False` |
|
||||||
|`keycloak_url` | URL for configuration rest calls | `http://{{ keycloak_host }}:{{ keycloak_http_port }}` |
|
|`keycloak_url` | URL for configuration rest calls | `http://{{ keycloak_host }}:{{ keycloak_http_port }}` |
|
||||||
|`keycloak_management_url` | URL for management console rest calls | `http://{{ keycloak_host }}:{{ keycloak_management_http_port }}` |
|
|`keycloak_management_url` | URL for management console rest calls | `http://{{ keycloak_host }}:{{ keycloak_management_http_port }}` |
|
||||||
|
|`keycloak_frontend_url_force` | Force backend requests to use the frontend URL | `False` |
|
||||||
|
|
||||||
Role Variables
|
Role Variables
|
||||||
--------------
|
--------------
|
||||||
|
|
|
@ -72,6 +72,7 @@ keycloak_modcluster_urls:
|
||||||
|
|
||||||
### keycloak frontend url
|
### keycloak frontend url
|
||||||
keycloak_frontend_url: http://localhost:8080/auth/
|
keycloak_frontend_url: http://localhost:8080/auth/
|
||||||
|
keycloak_frontend_url_force: False
|
||||||
|
|
||||||
### infinispan remote caches access (hotrod)
|
### infinispan remote caches access (hotrod)
|
||||||
keycloak_infinispan_user: supervisor
|
keycloak_infinispan_user: supervisor
|
||||||
|
|
|
@ -199,6 +199,10 @@ argument_specs:
|
||||||
default: "http://localhost"
|
default: "http://localhost"
|
||||||
description: "Frontend URL for keycloak endpoints when a reverse proxy is used"
|
description: "Frontend URL for keycloak endpoints when a reverse proxy is used"
|
||||||
type: "str"
|
type: "str"
|
||||||
|
keycloak_frontend_url_force:
|
||||||
|
default: False
|
||||||
|
description: "Force backend requests to use the frontend URL"
|
||||||
|
type: "bool"
|
||||||
keycloak_infinispan_user:
|
keycloak_infinispan_user:
|
||||||
# line 62 of keycloak/defaults/main.yml
|
# line 62 of keycloak/defaults/main.yml
|
||||||
default: "supervisor"
|
default: "supervisor"
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
- name: Determine latest version
|
- name: Determine latest version
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
sso_latest_version: "{{ filtered_versions | middleware_automation.keycloak.version_sort | last }}"
|
sso_latest_version: "{{ filtered_versions | middleware_automation.common.version_sort | last }}"
|
||||||
when: sso_patch_version is not defined or sso_patch_version | length == 0
|
when: sso_patch_version is not defined or sso_patch_version | length == 0
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
run_once: yes
|
run_once: yes
|
||||||
|
|
|
@ -573,7 +573,7 @@
|
||||||
<provider name="default" enabled="true">
|
<provider name="default" enabled="true">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="frontendUrl" value="{{ keycloak_modcluster.frontend_url }}"/>
|
<property name="frontendUrl" value="{{ keycloak_modcluster.frontend_url }}"/>
|
||||||
<property name="forceBackendUrlToFrontendUrl" value="true"/>
|
<property name="forceBackendUrlToFrontendUrl" value="{{ keycloak_modcluster.force_frontend_url }}"/>
|
||||||
</properties>
|
</properties>
|
||||||
</provider>
|
</provider>
|
||||||
</spi>
|
</spi>
|
||||||
|
|
|
@ -611,7 +611,7 @@
|
||||||
<provider name="default" enabled="true">
|
<provider name="default" enabled="true">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="frontendUrl" value="{{ keycloak_modcluster.frontend_url }}"/>
|
<property name="frontendUrl" value="{{ keycloak_modcluster.frontend_url }}"/>
|
||||||
<property name="forceBackendUrlToFrontendUrl" value="true"/>
|
<property name="forceBackendUrlToFrontendUrl" value="{{ keycloak_modcluster.force_frontend_url }}"/>
|
||||||
</properties>
|
</properties>
|
||||||
</provider>
|
</provider>
|
||||||
</spi>
|
</spi>
|
||||||
|
|
|
@ -517,7 +517,7 @@
|
||||||
<provider name="default" enabled="true">
|
<provider name="default" enabled="true">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="frontendUrl" value="{{ keycloak_modcluster.frontend_url }}"/>
|
<property name="frontendUrl" value="{{ keycloak_modcluster.frontend_url }}"/>
|
||||||
<property name="forceBackendUrlToFrontendUrl" value="true"/>
|
<property name="forceBackendUrlToFrontendUrl" value="{{ keycloak_modcluster.force_frontend_url }}"/>
|
||||||
</properties>
|
</properties>
|
||||||
</provider>
|
</provider>
|
||||||
</spi>
|
</spi>
|
||||||
|
|
|
@ -84,6 +84,7 @@ keycloak_modcluster:
|
||||||
enabled: "{{ keycloak_ha_enabled or keycloak_modcluster_enabled }}"
|
enabled: "{{ keycloak_ha_enabled or keycloak_modcluster_enabled }}"
|
||||||
reverse_proxy_urls: "{{ keycloak_modcluster_urls }}"
|
reverse_proxy_urls: "{{ keycloak_modcluster_urls }}"
|
||||||
frontend_url: "{{ keycloak_frontend_url }}"
|
frontend_url: "{{ keycloak_frontend_url }}"
|
||||||
|
force_frontend_url: "{{ keycloak_frontend_url_force }}"
|
||||||
|
|
||||||
# infinispan
|
# infinispan
|
||||||
keycloak_remotecache:
|
keycloak_remotecache:
|
||||||
|
|
Loading…
Add table
Reference in a new issue