mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2025-04-06 10:50:31 -07:00
#222: add support for local providers to be uploaded
This commit is contained in:
parent
d87c8ca8ac
commit
26316ddc50
5 changed files with 25 additions and 5 deletions
|
@ -39,6 +39,8 @@
|
||||||
version: 24.0.4 # optional
|
version: 24.0.4 # optional
|
||||||
# username: myUser # optional
|
# username: myUser # optional
|
||||||
# password: myPAT # optional
|
# password: myPAT # optional
|
||||||
|
# - id: my-static-theme
|
||||||
|
# local_path: /tmp/my-static-theme.jar
|
||||||
keycloak_quarkus_policies:
|
keycloak_quarkus_policies:
|
||||||
- name: "xato-net-10-million-passwords.txt"
|
- name: "xato-net-10-million-passwords.txt"
|
||||||
url: "https://github.com/danielmiessler/SecLists/raw/master/Passwords/xato-net-10-million-passwords.txt"
|
url: "https://github.com/danielmiessler/SecLists/raw/master/Passwords/xato-net-10-million-passwords.txt"
|
||||||
|
|
|
@ -178,15 +178,22 @@ Role Defaults
|
||||||
|:---------|:------------|:--------|
|
|:---------|:------------|:--------|
|
||||||
|`keycloak_quarkus_providers`| List of provider definitions; see below | `[]` |
|
|`keycloak_quarkus_providers`| List of provider definitions; see below | `[]` |
|
||||||
|
|
||||||
|
Providers support different sources:
|
||||||
|
|
||||||
|
* `url`: http download for SPIs not requiring authentication
|
||||||
|
* `maven`: maven download for SPIs hosted publicly on Apache Maven Central or private Maven repositories like Github Maven requiring authentication
|
||||||
|
* `local_path`: static SPIs to be uploaded
|
||||||
|
|
||||||
Provider definition:
|
Provider definition:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
keycloak_quarkus_providers:
|
keycloak_quarkus_providers:
|
||||||
- id: http-client # required
|
- id: http-client # required; "{{ id }}.jar" identifies the file name on RHBK
|
||||||
spi: connections # required if neither url nor maven are specified
|
spi: connections # required if neither url, local_path nor maven are specified; required for setting properties
|
||||||
default: true # optional, whether to set default for spi, default false
|
default: true # optional, whether to set default for spi, default false
|
||||||
restart: true # optional, whether to restart, default true
|
restart: true # optional, whether to restart, default true
|
||||||
url: https://.../.../custom_spi.jar # optional, url for download via http
|
url: https://.../.../custom_spi.jar # optional, url for download via http
|
||||||
|
local_path: my_theme_spi.jar # optional, path on local controller for SPI to be uploaded
|
||||||
maven: # optional, for download using maven
|
maven: # optional, for download using maven
|
||||||
repository_url: https://maven.pkg.github.com/OWNER/REPOSITORY # optional, maven repo url
|
repository_url: https://maven.pkg.github.com/OWNER/REPOSITORY # optional, maven repo url
|
||||||
group_id: my.group # optional, maven group id
|
group_id: my.group # optional, maven group id
|
||||||
|
|
|
@ -391,7 +391,7 @@ argument_specs:
|
||||||
default: 10
|
default: 10
|
||||||
type: 'int'
|
type: 'int'
|
||||||
keycloak_quarkus_providers:
|
keycloak_quarkus_providers:
|
||||||
description: "List of provider definition dicts: { 'id': str, 'spi': str, 'url': str, 'default': bool, 'properties': list of key/value TODO:add maven}"
|
description: "List of provider definition dicts: { 'id': str, 'spi': str, 'url': str, 'local_path': str, 'maven': { 'repository_url': str, 'group_id': str, 'artifact_id': str, 'version': str, 'username': str, optional, 'password': str, optional }, 'default': bool, 'properties': list of key/value }"
|
||||||
default: []
|
default: []
|
||||||
type: "list"
|
type: "list"
|
||||||
keycloak_quarkus_supported_policy_types:
|
keycloak_quarkus_supported_policy_types:
|
||||||
|
|
|
@ -256,6 +256,17 @@
|
||||||
when: item.maven is defined
|
when: item.maven is defined
|
||||||
no_log: "{{ item.maven.password is defined and item.maven.password | length > 0 | default(false) }}"
|
no_log: "{{ item.maven.password is defined and item.maven.password | length > 0 | default(false) }}"
|
||||||
|
|
||||||
|
- name: "Upload local SPIs"
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ item.local_path}}"
|
||||||
|
dest: "{{ keycloak.home }}/providers/{{ item.id }}.jar"
|
||||||
|
owner: "{{ keycloak.service_user }}"
|
||||||
|
group: "{{ keycloak.service_group }}"
|
||||||
|
mode: '0640'
|
||||||
|
become: true
|
||||||
|
loop: "{{ keycloak_quarkus_providers }}"
|
||||||
|
when: item.local_path is defined
|
||||||
|
|
||||||
- name: Ensure required folder structure for policies exists
|
- name: Ensure required folder structure for policies exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ keycloak.home }}/data/{{ item | lower }}"
|
path: "{{ keycloak.home }}/data/{{ item | lower }}"
|
||||||
|
|
|
@ -61,9 +61,9 @@
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- item.id is defined and item.id | length > 0
|
- item.id is defined and item.id | length > 0
|
||||||
- (item.spi is defined and item.spi | length > 0) or (item.url is defined and item.url | length > 0) or (item.maven is defined and item.maven.repository_url is defined and item.maven.repository_url | length > 0 and item.maven.group_id is defined and item.maven.group_id | length > 0 and item.maven.artifact_id is defined and item.maven.artifact_id | length > 0)
|
- (item.spi is defined and item.spi | length > 0) or (item.url is defined and item.url | length > 0) or (item.maven is defined and item.maven.repository_url is defined and item.maven.repository_url | length > 0 and item.maven.group_id is defined and item.maven.group_id | length > 0 and item.maven.artifact_id is defined and item.maven.artifact_id | length > 0) or (item.local_path is defined and item.local_path | length > 0)
|
||||||
quiet: true
|
quiet: true
|
||||||
fail_msg: "Providers definition is incorrect; `id` and one of `spi`, `url`, or `maven` are mandatory. `key` and `value` are mandatory for each property"
|
fail_msg: "Providers definition is incorrect; `id` and one of `spi`, `url`, `local_path`, or `maven` are mandatory. `key` and `value` are mandatory for each property"
|
||||||
loop: "{{ keycloak_quarkus_providers }}"
|
loop: "{{ keycloak_quarkus_providers }}"
|
||||||
|
|
||||||
- name: "Validate policies"
|
- name: "Validate policies"
|
||||||
|
|
Loading…
Add table
Reference in a new issue