diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index c59579c..68adf70 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -3,7 +3,7 @@ dependency: name: shell command: ansible-galaxy collection install -r molecule/default/requirements.yml -p $HOME/.ansible/collections --force-with-deps driver: - name: podman + name: docker platforms: - name: instance image: registry.access.redhat.com/ubi8/ubi-init:latest diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 425c16d..8dbc48d 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -4,6 +4,8 @@ tasks: - name: Disable beta repos command: yum config-manager --disable '*beta*' + ignore_errors: yes + - name: Install sudo yum: name: sudo diff --git a/roles/keycloak/README.md b/roles/keycloak/README.md index 745c5d3..a89320a 100644 --- a/roles/keycloak/README.md +++ b/roles/keycloak/README.md @@ -13,6 +13,14 @@ This role requires the `python3-netaddr` library installed on the controller nod * or via pip: `pip install netaddr==0.8.0` +Versions +-------- + +| RH-SSO VERSION | Release Date | Keycloak Version | EAP Version | Notes | +|:---------------|:------------------|:-----------------|:------------|:----------------| +|`7.5.0 GA` |September 20, 2021 |`15.0.2` | `7.4.0` |[Release Notes](https://access.redhat.com/documentation/en-us/red_hat_single_sign-on/7.5/html/release_notes/index)| + + Role Defaults ------------- diff --git a/roles/keycloak/defaults/main.yml b/roles/keycloak/defaults/main.yml index a75fc70..1baf784 100644 --- a/roles/keycloak/defaults/main.yml +++ b/roles/keycloak/defaults/main.yml @@ -1,14 +1,15 @@ --- ### Configuration specific to keycloak -keycloak_version: 9.0.2 -keycloak_archive: keycloak-{{ keycloak_version }}.zip -keycloak_download_url: https://downloads.jboss.org/keycloak/{{ keycloak_version }}/{{ keycloak_archive }} +keycloak_version: 15.0.2 +keycloak_archive: "keycloak-{{ keycloak_version }}.zip" +keycloak_download_url: "https://github.com/keycloak/keycloak/releases/download/{{ keycloak_version }}/{{ keycloak_archive }}" +keycloak_download_url_9x: "https://downloads.jboss.org/keycloak/{{ keycloak_version }}/{{ keycloak_archive }}" keycloak_installdir: "{{ keycloak_dest }}/keycloak-{{ keycloak_version }}" ### Configuration specific to Red Hat Single Sing-On keycloak_rhsso_enable: "{{ True if rhsso_rhn_id is defined else False }}" keycloak_rhsso_version: 7.5 -keycloak_rhsso_archive: rh-sso-{{ keycloak_rhsso_version }}-server-dist.zip +keycloak_rhsso_archive: "rh-sso-{{ keycloak_rhsso_version }}-server-dist.zip" keycloak_rhsso_installdir: "{{ keycloak_dest }}/rh-sso-{{ keycloak_rhsso_version }}" keycloak_rhsso_base_url: 'https://access.redhat.com/jbossnetwork/restricted/softwareDownload.html?softwareId=' diff --git a/roles/keycloak/tasks/install.yml b/roles/keycloak/tasks/install.yml index 88a0ab4..3044347 100644 --- a/roles/keycloak/tasks/install.yml +++ b/roles/keycloak/tasks/install.yml @@ -129,7 +129,7 @@ - name: "Deploy Keycloak's standalone.xml" become: yes template: - src: "{{ 'templates/standalone-rhsso.xml.j2' if keycloak_rhsso_enable else 'templates/standalone.xml.j2' }}" + src: templates/standalone.xml.j2 dest: "{{ keycloak_config_path_to_standalone_xml }}" owner: "{{ keycloak_service_user }}" group: "{{ keycloak_service_group }}" @@ -141,7 +141,7 @@ - name: "Deploy Keycloak's standalone.xml with remote cache store" become: yes template: - src: "{{ 'templates/standalone-rhsso-jdg.xml.j2' if keycloak_rhsso_enable else 'templates/standalone-infinispan.xml.j2' }}" + src: templates/standalone-infinispan.xml.j2 dest: "{{ keycloak_config_path_to_standalone_xml }}" owner: "{{ keycloak_service_user }}" group: "{{ keycloak_service_group }}" diff --git a/roles/keycloak/tasks/main.yml b/roles/keycloak/tasks/main.yml index 66f56b3..bcf0c06 100644 --- a/roles/keycloak/tasks/main.yml +++ b/roles/keycloak/tasks/main.yml @@ -6,9 +6,17 @@ tags: - prereqs -- include_tasks: tasks/install.yml +- name: Include install tasks + include_tasks: tasks/install.yml -- include_tasks: tasks/systemd.yml +- name: Include systemd tasks + include_tasks: tasks/systemd.yml + +- name: Link default logs directory + file: + state: link + src: "{{keycloak_jboss_home}}/standalone/log" + dest: /var/log/keycloak - block: - name: Check admin credentials by generating a token diff --git a/roles/keycloak/templates/standalone-rhsso-jdg.xml.j2 b/roles/keycloak/templates/9.0.2/standalone-infinispan.xml.j2 similarity index 89% rename from roles/keycloak/templates/standalone-rhsso-jdg.xml.j2 rename to roles/keycloak/templates/9.0.2/standalone-infinispan.xml.j2 index e73bf19..2b2842b 100644 --- a/roles/keycloak/templates/standalone-rhsso-jdg.xml.j2 +++ b/roles/keycloak/templates/9.0.2/standalone-infinispan.xml.j2 @@ -1,6 +1,6 @@ - + @@ -23,9 +23,10 @@ - - + + + @@ -44,7 +45,8 @@ - + @@ -141,7 +143,7 @@ - + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE @@ -152,15 +154,15 @@ -{% if keycloak_jdbc[keycloak_jdbc_engine].enabled %} - {{ keycloak_jdbc[keycloak_jdbc_engine].connection_url }} - {{ keycloak_jdbc[keycloak_jdbc_engine].driver_module_name }} +{% if keycloak_jdbc.postgres.enabled %} + {{ keycloak_jdbc.postgres.connection_url }} + {{ keycloak_jdbc.postgres.driver_module_name }} 20 - {{ keycloak_jdbc[keycloak_jdbc_engine].db_user }} - {{ keycloak_jdbc[keycloak_jdbc_engine].db_password }} + {{ keycloak_jdbc.postgres.db_user }} + {{ keycloak_jdbc.postgres.db_password }} {% else %} jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE @@ -172,10 +174,10 @@ {% endif %} -{% if keycloak_jdbc[keycloak_jdbc_engine].enabled %} - - {{ keycloak_jdbc[keycloak_jdbc_engine].driver_class }} - {{ keycloak_jdbc[keycloak_jdbc_engine].xa_datasource_class }} +{% if keycloak_jdbc.postgres.enabled %} + + org.postgresql.Driver + org.postgresql.xa.PGXADataSource {% endif %} @@ -187,7 +189,7 @@ - + false @@ -197,15 +199,17 @@ - + - + - + - + @@ -232,7 +236,7 @@ - + @@ -248,7 +252,7 @@ - + @@ -357,7 +361,7 @@ - + @@ -366,25 +370,24 @@ - - - + + - + - + - + -{% for cachename in [ "sessions", "offlineSessions", "clientSessions", "offlineClientSessions", "loginFailures", "actionTokens" ] %} + {% for cachename in [ "sessions", "offlineSessions", "clientSessions", "offlineClientSessions", "loginFailures", "actionTokens" ] %} {{ keycloak_remotecache.password }} {{ keycloak_remotecache.realm | default('default') }} {{ keycloak_remotecache.server_name }} - {{ keycloak_remotecache.sasl_mechanism }} - {{ keycloak_remotecache.use_ssl }} - {{ keycloak_remotecache.trust_store_path }} + {{ keycloak_remotecache.sasl_mechanism | default('SCRAM-SHA-512') }} + false + {{ keycloak_remotecache.trust_store_path | default('/etc/truststore/truststore.jks') }} JKS - {{ keycloak_remotecache.trust_store_password }} + {{ keycloak_remotecache.trust_store_password | default("changeme") }} TOPOLOGY_AWARE -{% endfor %} + {% endfor %} {{ keycloak_remotecache.password }} {{ keycloak_remotecache.realm | default('default') }} {{ keycloak_remotecache.server_name }} - {{ keycloak_remotecache.sasl_mechanism }} - {{ keycloak_remotecache.use_ssl }} - {{ keycloak_remotecache.trust_store_path }} + {{ keycloak_remotecache.sasl_mechanism | default('SCRAM-SHA-512') }} + false + {{ keycloak_remotecache.trust_store_path | default('/etc/truststore/truststore.jks') }} JKS - {{ keycloak_remotecache.trust_store_password }} + {{ keycloak_remotecache.trust_store_password | default("changeme") }} TOPOLOGY_AWARE - + - + - + - + @@ -457,13 +460,13 @@ - + - + - + @@ -473,7 +476,7 @@ - + @@ -493,7 +496,7 @@ - + @@ -530,7 +533,7 @@ - + auth @@ -612,13 +615,12 @@ - + - -{% if keycloak_modcluster.enabled %} +{% if keycloak_modcluster.enabled %} @@ -626,7 +628,7 @@ -{% endif %} +{% endif %} @@ -673,7 +675,7 @@ - + @@ -683,7 +685,9 @@ - + @@ -708,12 +712,18 @@ - + + + + - + {% if ansible_default_ipv4 is defined %} {% else %} diff --git a/roles/keycloak/templates/standalone-rhsso.xml.j2 b/roles/keycloak/templates/9.0.2/standalone.xml.j2 similarity index 88% rename from roles/keycloak/templates/standalone-rhsso.xml.j2 rename to roles/keycloak/templates/9.0.2/standalone.xml.j2 index b48883a..823357f 100644 --- a/roles/keycloak/templates/standalone-rhsso.xml.j2 +++ b/roles/keycloak/templates/9.0.2/standalone.xml.j2 @@ -1,6 +1,6 @@ - + @@ -22,9 +22,10 @@ - - + + + @@ -43,7 +44,8 @@ - + @@ -128,7 +130,7 @@ - + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE @@ -156,7 +158,7 @@ - + false @@ -166,15 +168,17 @@ - + - + - + - + @@ -201,7 +205,7 @@ - + @@ -217,7 +221,130 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{% if keycloak_modcluster.enabled %} + + + + + + + +{% endif %} + + + + + + + + + + + + + + + @@ -275,7 +402,6 @@ - @@ -317,126 +443,78 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + auth - - classpath:${jboss.home.dir}/providers/* - + classpath:${jboss.home.dir}/providers/* master 900 @@ -511,97 +589,6 @@ - - - - - - -{% if keycloak_modcluster.enabled %} - - - - - - - -{% endif %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -621,12 +608,12 @@ - + -{% if keycloak_modcluster.enabled %} +{% if keycloak_modcluster.enabled %} -{% endif %} +{% endif %} diff --git a/roles/keycloak/templates/keycloak-service.sh.j2 b/roles/keycloak/templates/keycloak-service.sh.j2 index 422ccde..82e3a21 100755 --- a/roles/keycloak/templates/keycloak-service.sh.j2 +++ b/roles/keycloak/templates/keycloak-service.sh.j2 @@ -83,8 +83,7 @@ startKeycloak() { -Djboss.management.https.port=${KEYCLOAK_MANAGEMENT_HTTPS_PORT} \ -Djboss.node.name={{ inventory_hostname }} \ {% if keycloak_prefer_ipv4 %}-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true {% endif %}\ - {% if keycloak_config_standalone_xml is defined %}--server-config={{ keycloak_config_standalone_xml }}{% endif %} \ - 2>&1 >> "${KEYCLOAK_LOGFILE}" & + {% if keycloak_config_standalone_xml is defined %}--server-config={{ keycloak_config_standalone_xml }}{% endif %} & while [ ! -f ${KEYCLOAK_PIDFILE} ]; do sleep 1; done fi } diff --git a/roles/keycloak/templates/standalone-infinispan.xml.j2 b/roles/keycloak/templates/standalone-infinispan.xml.j2 index 2b2842b..e73bf19 100644 --- a/roles/keycloak/templates/standalone-infinispan.xml.j2 +++ b/roles/keycloak/templates/standalone-infinispan.xml.j2 @@ -1,6 +1,6 @@ - + @@ -23,10 +23,9 @@ + - - - + @@ -45,8 +44,7 @@ - + @@ -143,7 +141,7 @@ - + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE @@ -154,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 @@ -174,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 %} @@ -189,7 +187,7 @@ - + false @@ -199,17 +197,15 @@ - + - + - + - + @@ -236,7 +232,7 @@ - + @@ -252,7 +248,7 @@ - + @@ -361,7 +357,7 @@ - + @@ -370,24 +366,25 @@ - - + + + - + - + - + - {% for cachename in [ "sessions", "offlineSessions", "clientSessions", "offlineClientSessions", "loginFailures", "actionTokens" ] %} +{% for cachename in [ "sessions", "offlineSessions", "clientSessions", "offlineClientSessions", "loginFailures", "actionTokens" ] %} {{ keycloak_remotecache.password }} {{ keycloak_remotecache.realm | default('default') }} {{ keycloak_remotecache.server_name }} - {{ keycloak_remotecache.sasl_mechanism | default('SCRAM-SHA-512') }} - false - {{ keycloak_remotecache.trust_store_path | default('/etc/truststore/truststore.jks') }} + {{ keycloak_remotecache.sasl_mechanism }} + {{ keycloak_remotecache.use_ssl }} + {{ keycloak_remotecache.trust_store_path }} JKS - {{ keycloak_remotecache.trust_store_password | default("changeme") }} + {{ keycloak_remotecache.trust_store_password }} TOPOLOGY_AWARE - {% endfor %} +{% endfor %} {{ keycloak_remotecache.password }} {{ keycloak_remotecache.realm | default('default') }} {{ keycloak_remotecache.server_name }} - {{ keycloak_remotecache.sasl_mechanism | default('SCRAM-SHA-512') }} - false - {{ keycloak_remotecache.trust_store_path | default('/etc/truststore/truststore.jks') }} + {{ keycloak_remotecache.sasl_mechanism }} + {{ keycloak_remotecache.use_ssl }} + {{ keycloak_remotecache.trust_store_path }} JKS - {{ keycloak_remotecache.trust_store_password | default("changeme") }} + {{ keycloak_remotecache.trust_store_password }} TOPOLOGY_AWARE - + - + - + - + @@ -460,13 +457,13 @@ - + - + - + @@ -476,7 +473,7 @@ - + @@ -496,7 +493,7 @@ - + @@ -533,7 +530,7 @@ - + auth @@ -615,12 +612,13 @@ - + -{% if keycloak_modcluster.enabled %} + +{% if keycloak_modcluster.enabled %} @@ -628,7 +626,7 @@ -{% endif %} +{% endif %} @@ -675,7 +673,7 @@ - + @@ -685,9 +683,7 @@ - + @@ -712,18 +708,12 @@ - - - - + - + {% if ansible_default_ipv4 is defined %} {% else %} diff --git a/roles/keycloak/templates/standalone.xml.j2 b/roles/keycloak/templates/standalone.xml.j2 index 823357f..b48883a 100644 --- a/roles/keycloak/templates/standalone.xml.j2 +++ b/roles/keycloak/templates/standalone.xml.j2 @@ -1,6 +1,6 @@ - + @@ -22,10 +22,9 @@ + - - - + @@ -44,8 +43,7 @@ - + @@ -130,7 +128,7 @@ - + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE @@ -158,7 +156,7 @@ - + false @@ -168,17 +166,15 @@ - + - + - + - + @@ -205,7 +201,7 @@ - + @@ -221,130 +217,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{% if keycloak_modcluster.enabled %} - - - - - - - -{% endif %} - - - - - - - - - - - - - - - + @@ -402,6 +275,7 @@ + @@ -443,78 +317,126 @@ + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + auth - classpath:${jboss.home.dir}/providers/* + + classpath:${jboss.home.dir}/providers/* + master 900 @@ -589,6 +511,97 @@ + + + + + + +{% if keycloak_modcluster.enabled %} + + + + + + + +{% endif %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -608,12 +621,12 @@ - + -{% if keycloak_modcluster.enabled %} +{% if keycloak_modcluster.enabled %} -{% endif %} +{% endif %}