From 89a4c722b4502ba6ed35bad439a0274e609157ba Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Sun, 19 Dec 2021 15:43:26 +0100 Subject: [PATCH] Add mysql module, bind jgroups to net --- roles/keycloak/defaults/main.yml | 4 ++ .../templates/standalone-infinispan.xml.j2 | 31 +++++++++++- .../templates/standalone-rhsso-jdg.xml.j2 | 47 +++++++++++++++---- 3 files changed, 70 insertions(+), 12 deletions(-) diff --git a/roles/keycloak/defaults/main.yml b/roles/keycloak/defaults/main.yml index db15e0f..b02053c 100644 --- a/roles/keycloak/defaults/main.yml +++ b/roles/keycloak/defaults/main.yml @@ -63,6 +63,8 @@ keycloak_jdbc_engine: postgres keycloak_jdbc: postgres: enabled: "{{ keycloak_ha_enabled and keycloak_jdbc_engine == 'postgres' }}" + driver_class: org.postgresql.Driver + xa_datasource_class: org.postgresql.xa.PGXADataSource driver_module_name: "org.postgresql" driver_module_dir: "{{ keycloak_jboss_home }}/modules/org/postgresql/main" driver_version: 9.4.1212 @@ -73,6 +75,8 @@ keycloak_jdbc: db_password: "{{ postgres_db_pass | default('keycloak-pass') }}" mariadb: enabled: "{{ keycloak_ha_enabled and keycloak_jdbc_engine == 'mariadb' }}" + driver_class: org.mariadb.jdbc.Driver + xa_datasource_class: org.mariadb.jdbc.MySQLDataSource driver_module_name: "org.mariadb" driver_module_dir: "{{ keycloak_jboss_home }}/modules/org/mariadb/main" driver_version: 2.7.4 diff --git a/roles/keycloak/templates/standalone-infinispan.xml.j2 b/roles/keycloak/templates/standalone-infinispan.xml.j2 index 3e07df1..fd97e84 100644 --- a/roles/keycloak/templates/standalone-infinispan.xml.j2 +++ b/roles/keycloak/templates/standalone-infinispan.xml.j2 @@ -498,6 +498,30 @@ + + java:jboss/datasources/KeycloakDS + + CREATE TABLE IF NOT EXISTS JGROUPSPING ( + own_addr varchar(200) NOT NULL, + cluster_name varchar(200) NOT NULL, + updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + ping_data varbinary(5000) DEFAULT NULL, + PRIMARY KEY (own_addr, cluster_name)) + ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin + + + + + + + + + + + 30000 + + + @@ -690,6 +714,9 @@ + + + @@ -700,14 +727,14 @@ - + -{% if keycloak_modcluster.enabled %} +{% if keycloak_modcluster.enabled %} diff --git a/roles/keycloak/templates/standalone-rhsso-jdg.xml.j2 b/roles/keycloak/templates/standalone-rhsso-jdg.xml.j2 index 65dd4f7..af69585 100644 --- a/roles/keycloak/templates/standalone-rhsso-jdg.xml.j2 +++ b/roles/keycloak/templates/standalone-rhsso-jdg.xml.j2 @@ -152,15 +152,15 @@ -{% if keycloak_jdbc.postgres.enabled %} - {{ keycloak_jdbc.postgres.connection_url }} - {{ keycloak_jdbc.postgres.driver_module_name }} +{% if keycloak_jdbc[keycloak_jdbc_engine].enabled %} + {{ keycloak_jdbc[keycloak_jdbc_engine].connection_url }} + {{ keycloak_jdbc[keycloak_jdbc_engine].driver_module_name }} 20 - {{ keycloak_jdbc.postgres.db_user }} - {{ keycloak_jdbc.postgres.db_password }} + {{ keycloak_jdbc[keycloak_jdbc_engine].db_user }} + {{ keycloak_jdbc[keycloak_jdbc_engine].db_password }} {% else %} jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE @@ -172,10 +172,10 @@ {% endif %} -{% if keycloak_jdbc.postgres.enabled %} - - org.postgresql.Driver - org.postgresql.xa.PGXADataSource +{% if keycloak_jdbc[keycloak_jdbc_engine].enabled %} + + {{ keycloak_jdbc[keycloak_jdbc_engine].driver_class }} + {{ keycloak_jdbc[keycloak_jdbc_engine].xa_datasource_class }} {% endif %} @@ -498,6 +498,30 @@ + + java:jboss/datasources/KeycloakDS + + CREATE TABLE IF NOT EXISTS JGROUPSPING ( + own_addr varchar(200) NOT NULL, + cluster_name varchar(200) NOT NULL, + updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + ping_data varbinary(5000) DEFAULT NULL, + PRIMARY KEY (own_addr, cluster_name)) + ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin + + + + + + + + + + + 30000 + + + @@ -690,6 +714,9 @@ + + + @@ -700,7 +727,7 @@ - +