diff --git a/defaults/main.yml b/defaults/main.yml index afde7b8..a78dc3f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -36,6 +36,18 @@ keycloak_remote_providers: [] # maven_extension: '' # maven_version: '' +keycloak_remote_providers_url: [] + # - name: 'foo' + # url: '' + # [optional] + # dest_file: '' # to force file name different from 'url' + # force: 'true|false' + # checksum: '' + # validate_certs: 'true|false' + # force_basic_auth: 'true|false' + # username: '' + # password: '' + keycloak_additional_properties: [] keycloak_quarkus_additional_properties: [] diff --git a/tasks/keycloak-providers.yml b/tasks/keycloak-providers.yml index 2635046..0219695 100644 --- a/tasks/keycloak-providers.yml +++ b/tasks/keycloak-providers.yml @@ -1,19 +1,34 @@ --- - name: keycloak-providers | Get the keycloak providers - community.general.maven_artifact: - artifact_id: "{{ item.maven_id }}" - version: "{{ item.maven_version | default('latest') }}" - group_id: "{{ item.maven_group_id }}" - extension: "{{ item.maven_extension | default('jar') }}" - repository_url: "{{ item.maven_repo_url }}" - dest: "{{ keycloak_providers_directory }}/{{ item.name }}.{{ item.maven_extension | default('jar') }}" - verify_checksum: always - mode: "0644" - loop: '{{ keycloak_remote_providers }}' - when: item.maven_extension is not defined or item.maven_extension != "ear" - notify: Restart Keycloak - tags: - keycloak - keycloak_providers - keycloak_providers_jar + block: + - name: keycloak-providers | Getting maven artifact providers + community.general.maven_artifact: + artifact_id: "{{ item.maven_id }}" + version: "{{ item.maven_version | default('latest') }}" + group_id: "{{ item.maven_group_id }}" + extension: "{{ item.maven_extension | default('jar') }}" + repository_url: "{{ item.maven_repo_url }}" + dest: "{{ keycloak_providers_directory }}/{{ item.name }}.{{ item.maven_extension | default('jar') }}" + verify_checksum: always + mode: "0644" + loop: '{{ keycloak_remote_providers }}' + when: item.maven_extension is not defined or item.maven_extension != "ear" + notify: Restart Keycloak + + - name: keycloak-providers | Getting providers from URL + ansible.builtin.get_url: + url: "{{ item.url }}" + dest: "{{ keycloak_providers_directory }}/{{ item.dest_file | default('') }}" + force: "{{ item.force | default( omit ) }}" + checksum: "{{ item.checksum | default( omit ) }}" + validate_certs: "{{ item.validate_certs | default( omit ) }}" + force_basic_auth: "{{ item.force_basic_auth | default( omit ) }}" + url_username: "{{ item.username | default( omit ) }}" + url_password: "{{ item.password | default( omit ) }}" + mode: "0644" + loop: '{{ keycloak_remote_providers_url }}' + notify: Restart Keycloak \ No newline at end of file