Parametrize jdbc driver version

main
Guido Grazioli 2022-01-05 13:53:29 +01:00
parent 967d68898a
commit 53c5ef645a
3 changed files with 29 additions and 31 deletions

View File

@ -53,22 +53,14 @@ The following variables are _required_ only when keycloak_ha_enabled is True:
|`infinispan_trust_store_password`| Password for opening truststore | `changeit` |
The following variables are _required_ only when keycloak_db_enabled is True and keycloak_jdbc_engine is postgres:
The following variables are _required_ only when keycloak_db_enabled is True:
| Variable | Description | Default |
|:---------|:------------|:---------|
|`postgres_jdbc_url` | URL for the postgres backend database | `jdbc:postgresql://localhost:5432/keycloak` |
|`postgres_db_user` | username for connecting to postgres | `keycloak-user` |
|`postgres_db_pass` | password for connecting to postgres | `keycloak-pass` |
The following variables are _required_ only when keycloak_db_enabled is True and keycloak_jdbc_engine is mariadb:
| Variable | Description | Default |
|:---------|:------------|:---------|
|`mariadb_jdbc_url` | URL for the mariadb backend database | `jdbc:mariadb://localhost:3306/keycloak` |
|`mariadb_db_user` | username for connecting to mariadb | `keycloak-user` |
|`mariadb_db_pass` | password for connecting to mariadb | `keycloak-pass` |
|`keycloak_jdbc_url` | URL for the postgres backend database | `jdbc:postgresql://localhost:5432/keycloak` |
|`keycloak_jdbc_driver_version`| Version for the JDBC driver to download | `9.4.1212` |
|`keycloak_db_user` | username for connecting to postgres | `keycloak-user` |
|`keycloak_db_pass` | password for connecting to postgres | `keycloak-pass` |
Dependencies

View File

@ -63,9 +63,15 @@ infinispan_trust_store_password: changeit
### database backend engine: values [ 'postgres', 'mariadb' ]
keycloak_jdbc_engine: postgres
### database backend credentials
postgres_jdbc_url: 'jdbc:postgresql://localhost:5432/keycloak'
postgres_db_user: keycloak-user
postgres_db_pass: keycloak-pass
mariadb_jdbc_url: 'jdbc:mariadb://localhost:3306/keycloak'
mariadb_db_user: keycloak-user
mariadb_db_pass: keycloak-pass
keycloak_db_user: keycloak-user
keycloak_db_pass: keycloak-pass
keycloak_jdbc_url: "{{ keycloak_default_jdbc[keycloak_jdbc_engine].url }}"
keycloak_jdbc_driver_version: "{{ keycloak_default_jdbc[keycloak_jdbc_engine].version }}"
# override the variables above, following defaults show minimum supported versions
keycloak_default_jdbc:
postgres:
url: 'jdbc:postgresql://localhost:5432/keycloak'
version: 9.4.1212
mariadb:
url: 'jdbc:mariadb://localhost:3306/keycloak'
version: 2.7.4

View File

@ -17,12 +17,12 @@ keycloak_jdbc:
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
driver_jar_filename: "postgresql-9.4.1212.jar"
driver_jar_url: "https://repo.maven.apache.org/maven2/org/postgresql/postgresql/9.4.1212/postgresql-9.4.1212.jar"
connection_url: "{{ postgres_jdbc_url }}"
db_user: "{{ postgres_db_user }}"
db_password: "{{ postgres_db_pass }}"
driver_version: "{{ keycloak_jdbc_driver_version }}"
driver_jar_filename: "postgresql-{{ keycloak_jdbc_driver_version }}.jar"
driver_jar_url: "https://repo.maven.apache.org/maven2/org/postgresql/postgresql/{{ keycloak_jdbc_driver_version }}/postgresql-{{ keycloak_jdbc_driver_version }}.jar"
connection_url: "{{ keycloak_jdbc_url }}"
db_user: "{{ keycloak_db_user }}"
db_password: "{{ keycloak_db_pass }}"
initialize_db: >
CREATE TABLE IF NOT EXISTS JGROUPSPING (
own_addr varchar(200) NOT NULL,
@ -36,12 +36,12 @@ keycloak_jdbc:
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
driver_jar_filename: "mariadb-java-client-2.7.4.jar"
driver_jar_url: "https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/2.7.4/mariadb-java-client-2.7.4.jar"
connection_url: "{{ mariadb_jdbc_url }}"
db_user: "{{ mariadb_db_user }}"
db_password: "{{ mariadb_db_pass }}"
driver_version: "{{ keycloak_jdbc_driver_version }}"
driver_jar_filename: "mariadb-java-client-{{ keycloak_jdbc_driver_version }}.jar"
driver_jar_url: "https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/{{ keycloak_jdbc_driver_version }}/mariadb-java-client-{{ keycloak_jdbc_driver_version }}.jar"
connection_url: "{{ keycloak_jdbc_url }}"
db_user: "{{ keycloak_db_user }}"
db_password: "{{ keycloak_db_pass }}"
initialize_db: >
CREATE TABLE IF NOT EXISTS JGROUPSPING (
own_addr varchar(200) NOT NULL,