mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2025-04-09 04:10:27 -07:00
Merge pull request #60 from guidograzioli/modcluster_proxy_list
Provide config for multiple modcluster proxies
This commit is contained in:
commit
e15ebd3233
8 changed files with 43 additions and 14 deletions
|
@ -4,6 +4,12 @@
|
||||||
vars:
|
vars:
|
||||||
keycloak_admin_password: "remembertochangeme"
|
keycloak_admin_password: "remembertochangeme"
|
||||||
keycloak_jvm_package: java-11-openjdk-headless
|
keycloak_jvm_package: java-11-openjdk-headless
|
||||||
|
keycloak_modcluster_enabled: True
|
||||||
|
keycloak_modcluster_urls:
|
||||||
|
- host: myhost1
|
||||||
|
port: 16667
|
||||||
|
- host: myhost2
|
||||||
|
port: 16668
|
||||||
roles:
|
roles:
|
||||||
- role: keycloak
|
- role: keycloak
|
||||||
tasks:
|
tasks:
|
||||||
|
|
|
@ -115,8 +115,11 @@ The following are a set of _required_ variables for the role:
|
||||||
The following variables are _required_ only when `keycloak_ha_enabled` is True:
|
The following variables are _required_ only when `keycloak_ha_enabled` is True:
|
||||||
|
|
||||||
| Variable | Description | Default |
|
| Variable | Description | Default |
|
||||||
|:---------|:------------|:---------|
|
|:---------|:------------|:--------|
|
||||||
|`keycloak_modcluster_url` | URL for the modcluster reverse proxy | `localhost` |
|
|`keycloak_modcluster_enabled`| Enable configuration for modcluster subsystem | `True` if `keycloak_ha_enabled` is True, else `False` |
|
||||||
|
|`keycloak_modcluster_url` | _deprecated_ Host for the modcluster reverse proxy | `localhost` |
|
||||||
|
|`keycloak_modcluster_port` | _deprecated_ Port for the modcluster reverse proxy | `6666` |
|
||||||
|
|`keycloak_modcluster_urls` | List of {host,port} dicts for the modcluster reverse proxies | `[ { localhost:6666 } ]` |
|
||||||
|`keycloak_jdbc_engine` | backend database engine when db is enabled: [ postgres, mariadb ] | `postgres` |
|
|`keycloak_jdbc_engine` | backend database engine when db is enabled: [ postgres, mariadb ] | `postgres` |
|
||||||
|`keycloak_infinispan_url` | URL for the infinispan remote-cache server | `localhost:11122` |
|
|`keycloak_infinispan_url` | URL for the infinispan remote-cache server | `localhost:11122` |
|
||||||
|`keycloak_infinispan_user` | username for connecting to infinispan | `supervisor` |
|
|`keycloak_infinispan_user` | username for connecting to infinispan | `supervisor` |
|
||||||
|
|
|
@ -54,8 +54,13 @@ keycloak_auth_client: admin-cli
|
||||||
|
|
||||||
keycloak_force_install: False
|
keycloak_force_install: False
|
||||||
|
|
||||||
### mod_cluster reverse proxy
|
### mod_cluster reverse proxy list
|
||||||
|
keycloak_modcluster_enabled: "{{ True if keycloak_ha_enabled else False }}"
|
||||||
keycloak_modcluster_url: localhost
|
keycloak_modcluster_url: localhost
|
||||||
|
keycloak_modcluster_port: 6666
|
||||||
|
keycloak_modcluster_urls:
|
||||||
|
- host: "{{ keycloak_modcluster_url }}"
|
||||||
|
port: "{{ keycloak_modcluster_port }}"
|
||||||
|
|
||||||
### keycloak frontend url
|
### keycloak frontend url
|
||||||
keycloak_frontend_url: http://localhost:8080/auth
|
keycloak_frontend_url: http://localhost:8080/auth
|
||||||
|
|
|
@ -152,7 +152,7 @@ argument_specs:
|
||||||
# line 48 of keycloak/defaults/main.yml
|
# line 48 of keycloak/defaults/main.yml
|
||||||
default: "{{ True if keycloak_ha_enabled else False }}"
|
default: "{{ True if keycloak_ha_enabled else False }}"
|
||||||
description: "Enable auto configuration for database backend"
|
description: "Enable auto configuration for database backend"
|
||||||
type: "str"
|
type: "bool"
|
||||||
keycloak_admin_user:
|
keycloak_admin_user:
|
||||||
# line 51 of keycloak/defaults/main.yml
|
# line 51 of keycloak/defaults/main.yml
|
||||||
default: "admin"
|
default: "admin"
|
||||||
|
@ -173,11 +173,23 @@ argument_specs:
|
||||||
default: false
|
default: false
|
||||||
description: "Remove pre-existing versions of service"
|
description: "Remove pre-existing versions of service"
|
||||||
type: "bool"
|
type: "bool"
|
||||||
|
keycloak_modcluster_enabled:
|
||||||
|
default: "{{ True if keycloak_ha_enabled else False }}"
|
||||||
|
description: "Enable configuration for modcluster subsystem"
|
||||||
|
type: "bool"
|
||||||
keycloak_modcluster_url:
|
keycloak_modcluster_url:
|
||||||
# line 58 of keycloak/defaults/main.yml
|
# line 58 of keycloak/defaults/main.yml
|
||||||
default: "localhost"
|
default: "localhost"
|
||||||
description: "URL for the modcluster reverse proxy"
|
description: "URL for the modcluster reverse proxy"
|
||||||
type: "str"
|
type: "str"
|
||||||
|
keycloak_modcluster_port:
|
||||||
|
default: 6666
|
||||||
|
description: "Port for the modcluster reverse proxy"
|
||||||
|
type: "int"
|
||||||
|
keycloak_modcluster_urls:
|
||||||
|
default: "[ { host: 'localhost', port: 6666 } ]"
|
||||||
|
description: "List of modproxy node URLs in the format { host, port } for the modcluster reverse proxy"
|
||||||
|
type: "list"
|
||||||
keycloak_frontend_url:
|
keycloak_frontend_url:
|
||||||
# line 59 of keycloak/defaults/main.yml
|
# line 59 of keycloak/defaults/main.yml
|
||||||
default: "http://localhost"
|
default: "http://localhost"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
---
|
---
|
||||||
# tasks file for keycloak
|
# tasks file for keycloak
|
||||||
|
|
||||||
- name: Check prerequisites
|
- name: Check prerequisites
|
||||||
ansible.builtin.include_tasks: prereqs.yml
|
ansible.builtin.include_tasks: prereqs.yml
|
||||||
tags:
|
tags:
|
||||||
|
|
|
@ -617,7 +617,7 @@
|
||||||
<subsystem xmlns="urn:wildfly:metrics:1.0" security-enabled="false" exposed-subsystems="*" prefix="${wildfly.metrics.prefix:jboss}"/>
|
<subsystem xmlns="urn:wildfly:metrics:1.0" security-enabled="false" exposed-subsystems="*" prefix="${wildfly.metrics.prefix:jboss}"/>
|
||||||
{% if keycloak_modcluster.enabled %}
|
{% if keycloak_modcluster.enabled %}
|
||||||
<subsystem xmlns="urn:jboss:domain:modcluster:5.0">
|
<subsystem xmlns="urn:jboss:domain:modcluster:5.0">
|
||||||
<proxy name="default" advertise="false" listener="ajp" proxies="proxy1">
|
<proxy name="default" advertise="false" listener="ajp" proxies="{{ ['proxy_'] | product(keycloak_modcluster.reverse_proxy_urls | map(attribute='host')) | map('join') | list | join(' ') }}">
|
||||||
<dynamic-load-provider>
|
<dynamic-load-provider>
|
||||||
<load-metric type="cpu"/>
|
<load-metric type="cpu"/>
|
||||||
</dynamic-load-provider>
|
</dynamic-load-provider>
|
||||||
|
@ -705,9 +705,11 @@
|
||||||
<remote-destination host="${jboss.mail.server.host:localhost}" port="${jboss.mail.server.port:25}"/>
|
<remote-destination host="${jboss.mail.server.host:localhost}" port="${jboss.mail.server.port:25}"/>
|
||||||
</outbound-socket-binding>
|
</outbound-socket-binding>
|
||||||
{% if keycloak_modcluster.enabled %}
|
{% if keycloak_modcluster.enabled %}
|
||||||
<outbound-socket-binding name="proxy1">
|
{% for modcluster in keycloak_modcluster.reverse_proxy_urls %}
|
||||||
<remote-destination host="{{ keycloak_modcluster.reverse_proxy_url | default('localhost') }}" port="6666"/>
|
<outbound-socket-binding name="proxy_{{ modcluster.host }}">
|
||||||
|
<remote-destination host="{{ modcluster.host }}" port="{{ modcluster.port }}"/>
|
||||||
</outbound-socket-binding>
|
</outbound-socket-binding>
|
||||||
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<outbound-socket-binding name="remote-cache">
|
<outbound-socket-binding name="remote-cache">
|
||||||
<remote-destination host="{{ keycloak_remotecache.server_name | default('localhost') }}" port="${remote.cache.port:11222}"/>
|
<remote-destination host="{{ keycloak_remotecache.server_name | default('localhost') }}" port="${remote.cache.port:11222}"/>
|
||||||
|
|
|
@ -530,7 +530,7 @@
|
||||||
<subsystem xmlns="urn:wildfly:metrics:1.0" security-enabled="false" exposed-subsystems="*" prefix="${wildfly.metrics.prefix:jboss}"/>
|
<subsystem xmlns="urn:wildfly:metrics:1.0" security-enabled="false" exposed-subsystems="*" prefix="${wildfly.metrics.prefix:jboss}"/>
|
||||||
{% if keycloak_modcluster.enabled %}
|
{% if keycloak_modcluster.enabled %}
|
||||||
<subsystem xmlns="urn:jboss:domain:modcluster:5.0">
|
<subsystem xmlns="urn:jboss:domain:modcluster:5.0">
|
||||||
<proxy name="default" advertise="false" listener="ajp" proxies="proxy1">
|
<proxy name="default" advertise="false" listener="ajp" proxies="{{ ['proxy_'] | product(keycloak_modcluster.reverse_proxy_urls | map(attribute='host')) | map('join') | list | join(' ') }}">
|
||||||
<dynamic-load-provider>
|
<dynamic-load-provider>
|
||||||
<load-metric type="cpu"/>
|
<load-metric type="cpu"/>
|
||||||
</dynamic-load-provider>
|
</dynamic-load-provider>
|
||||||
|
@ -604,10 +604,12 @@
|
||||||
<outbound-socket-binding name="mail-smtp">
|
<outbound-socket-binding name="mail-smtp">
|
||||||
<remote-destination host="${jboss.mail.server.host:localhost}" port="${jboss.mail.server.port:25}"/>
|
<remote-destination host="${jboss.mail.server.host:localhost}" port="${jboss.mail.server.port:25}"/>
|
||||||
</outbound-socket-binding>
|
</outbound-socket-binding>
|
||||||
{% if keycloak_modcluster.enabled %}
|
{% if keycloak_modcluster.enabled %}
|
||||||
<outbound-socket-binding name="proxy1">
|
{% for modcluster in keycloak_modcluster.reverse_proxy_urls %}
|
||||||
<remote-destination host="{{ keycloak_modcluster.reverse_proxy_url | default('localhost') }}" port="6666"/>
|
<outbound-socket-binding name="proxy_{{ modcluster.host }}">
|
||||||
|
<remote-destination host="{{ modcluster.host }}" port="{{ modcluster.port }}"/>
|
||||||
</outbound-socket-binding>
|
</outbound-socket-binding>
|
||||||
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</socket-binding-group>
|
</socket-binding-group>
|
||||||
</server>
|
</server>
|
||||||
|
|
|
@ -59,8 +59,8 @@ keycloak_jdbc:
|
||||||
|
|
||||||
# reverse proxy mod_cluster
|
# reverse proxy mod_cluster
|
||||||
keycloak_modcluster:
|
keycloak_modcluster:
|
||||||
enabled: "{{ keycloak_ha_enabled }}"
|
enabled: "{{ keycloak_ha_enabled or keycloak_modcluster_enabled }}"
|
||||||
reverse_proxy_url: "{{ keycloak_modcluster_url }}"
|
reverse_proxy_urls: "{{ keycloak_modcluster_urls }}"
|
||||||
frontend_url: "{{ keycloak_frontend_url }}"
|
frontend_url: "{{ keycloak_frontend_url }}"
|
||||||
|
|
||||||
# infinispan
|
# infinispan
|
||||||
|
|
Loading…
Add table
Reference in a new issue