From 69a8860551e3298ebe213a2724964f6950a27e87 Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Mon, 19 Sep 2022 22:07:23 +0200 Subject: [PATCH] Break dependency on wildfly/eap --- molecule/default/requirements.yml | 2 -- molecule/overridexml/requirements.yml | 2 -- molecule/quarkus/requirements.yml | 2 -- requirements.yml | 2 -- roles/keycloak/tasks/install.yml | 11 +----- roles/keycloak/tasks/jdbc_driver.yml | 36 +++++++++++++++++++ .../templates/jdbc_driver_module.xml.j2 | 10 ++++++ 7 files changed, 47 insertions(+), 18 deletions(-) create mode 100644 roles/keycloak/tasks/jdbc_driver.yml create mode 100644 roles/keycloak/templates/jdbc_driver_module.xml.j2 diff --git a/molecule/default/requirements.yml b/molecule/default/requirements.yml index 9aa3437..de3dc3e 100644 --- a/molecule/default/requirements.yml +++ b/molecule/default/requirements.yml @@ -2,8 +2,6 @@ collections: - name: middleware_automation.redhat_csp_download version: ">=1.2.1" - - name: middleware_automation.wildfly - version: ">=0.0.5" - name: community.general - name: community.docker version: ">=1.9.1" diff --git a/molecule/overridexml/requirements.yml b/molecule/overridexml/requirements.yml index 9aa3437..de3dc3e 100644 --- a/molecule/overridexml/requirements.yml +++ b/molecule/overridexml/requirements.yml @@ -2,8 +2,6 @@ collections: - name: middleware_automation.redhat_csp_download version: ">=1.2.1" - - name: middleware_automation.wildfly - version: ">=0.0.5" - name: community.general - name: community.docker version: ">=1.9.1" diff --git a/molecule/quarkus/requirements.yml b/molecule/quarkus/requirements.yml index 9aa3437..de3dc3e 100644 --- a/molecule/quarkus/requirements.yml +++ b/molecule/quarkus/requirements.yml @@ -2,8 +2,6 @@ collections: - name: middleware_automation.redhat_csp_download version: ">=1.2.1" - - name: middleware_automation.wildfly - version: ">=0.0.5" - name: community.general - name: community.docker version: ">=1.9.1" diff --git a/requirements.yml b/requirements.yml index ab434b2..1ae6626 100644 --- a/requirements.yml +++ b/requirements.yml @@ -2,6 +2,4 @@ collections: - name: middleware_automation.redhat_csp_download version: ">=1.2.1" - - name: middleware_automation.wildfly - version: ">=0.0.5" - name: community.general diff --git a/roles/keycloak/tasks/install.yml b/roles/keycloak/tasks/install.yml index 5f85274..af14c75 100644 --- a/roles/keycloak/tasks/install.yml +++ b/roles/keycloak/tasks/install.yml @@ -172,16 +172,7 @@ # driver and configuration - name: "Install {{ keycloak_jdbc_engine }} driver" - ansible.builtin.include_role: - name: middleware_automation.wildfly.wildfly_driver - vars: - wildfly_user: "{{ keycloak_service_user }}" - jdbc_driver_module_dir: "{{ keycloak_jdbc[keycloak_jdbc_engine].driver_module_dir }}" - jdbc_driver_version: "{{ keycloak_jdbc[keycloak_jdbc_engine].driver_version }}" - jdbc_driver_jar_filename: "{{ keycloak_jdbc[keycloak_jdbc_engine].driver_jar_filename }}" - jdbc_driver_jar_url: "{{ keycloak_jdbc[keycloak_jdbc_engine].driver_jar_url }}" - jdbc_driver_jar_installation_path: "{{ keycloak_jdbc[keycloak_jdbc_engine].driver_module_dir }}/{{ keycloak_jdbc[keycloak_jdbc_engine].driver_jar_filename }}" - jdbc_driver_module_name: "{{ keycloak_jdbc[keycloak_jdbc_engine].driver_module_name }}" + ansible.builtin.include_tasks: jdbc_driver.yml when: keycloak_jdbc[keycloak_jdbc_engine].enabled - name: "Deploy {{ keycloak.service_name }} config to {{ keycloak_config_path_to_standalone_xml }} from {{ keycloak.config_template_source }}" diff --git a/roles/keycloak/tasks/jdbc_driver.yml b/roles/keycloak/tasks/jdbc_driver.yml new file mode 100644 index 0000000..3f93c53 --- /dev/null +++ b/roles/keycloak/tasks/jdbc_driver.yml @@ -0,0 +1,36 @@ +--- +- name: "Check module directory: {{ keycloak_jdbc[keycloak_jdbc_engine].driver_module_dir }}" + ansible.builtin.stat: + path: "{{ keycloak_jdbc[keycloak_jdbc_engine].driver_module_dir }}" + register: dest_path + become: yes + +- name: "Set up module dir for JDBC Driver {{ keycloak_jdbc[keycloak_jdbc_engine].driver_module_name }}" + ansible.builtin.file: + path: "{{ keycloak_jdbc[keycloak_jdbc_engine].driver_module_dir }}" + state: directory + recurse: yes + owner: "{{ keycloak_service_user }}" + group: "{{ keycloak_service_group }}" + mode: 0750 + become: yes + when: + - not dest_path.stat.exists + +- name: "Retrieve JDBC Driver from {{ keycloak_jdbc[keycloak_jdbc_engine].driver_jar_url }}" + ansible.builtin.uri: + url: "{{ keycloak_jdbc[keycloak_jdbc_engine].driver_jar_url }}" + dest: "{{ keycloak_jdbc[keycloak_jdbc_engine].driver_module_dir }}/{{ keycloak_jdbc[keycloak_jdbc_engine].driver_jar_filename }}" + group: "{{ keycloak_service_group }}" + owner: "{{ keycloak_service_user }}" + mode: 0640 + become: yes + +- name: "Deploy module.xml for JDBC Driver" + ansible.builtin.template: + src: "templates/jdbc_driver_module.xml.j2" + dest: "{{ keycloak_jdbc[keycloak_jdbc_engine].driver_module_dir }}/module.xml" + group: "{{ keycloak_service_group }}" + owner: "{{ keycloak_service_user }}" + mode: 0640 + become: yes diff --git a/roles/keycloak/templates/jdbc_driver_module.xml.j2 b/roles/keycloak/templates/jdbc_driver_module.xml.j2 new file mode 100644 index 0000000..c513693 --- /dev/null +++ b/roles/keycloak/templates/jdbc_driver_module.xml.j2 @@ -0,0 +1,10 @@ + + + + + + + + + +