Add validation of realm client and id

This commit is contained in:
Guido Grazioli
2022-12-13 11:20:44 +01:00
parent db111aaf3a
commit bdc1ad8b51
5 changed files with 111 additions and 65 deletions

View File

@@ -53,6 +53,17 @@
loop: "{{ keycloak_user_federation | flatten }}"
when: keycloak_user_federation is defined
- name: Validate Keycloak clients
ansible.builtin.assert:
that:
- item.name is defined and item.name | length > 0
- (item.client_id is defined and item.client_id | length > 0) or (item.id is defined and item.id | length > 0)
fail_msg: "For each keycloak client, attributes `name` and either `id` or `client_id` is required"
quiet: True
loop: "{{ keycloak_clients | flatten }}"
loop_control:
label: "{{ item.name | default('unnamed client') }}"
- name: Create or update a Keycloak client
community.general.keycloak_client:
auth_client_id: "{{ keycloak_auth_client }}"
@@ -97,4 +108,4 @@
loop: "{{ keycloak_clients | flatten }}"
loop_control:
loop_var: client
when: "'users' in client"
when: "'users' in client"