diff --git a/roles/keycloak_realm/tasks/main.yml b/roles/keycloak_realm/tasks/main.yml index 343b036..ab1a3d4 100644 --- a/roles/keycloak_realm/tasks/main.yml +++ b/roles/keycloak_realm/tasks/main.yml @@ -42,6 +42,7 @@ auth_username: "{{ keycloak_admin_user }}" auth_password: "{{ keycloak_admin_password }}" realm: "{{ item.realm }}" + default_roles: "{{ item.roles | default(omit) }}" client_id: "{{ item.client_id | default(omit) }}" id: "{{ item.id | default(omit) }}" name: "{{ item.name | default(omit) }}" @@ -62,7 +63,7 @@ state: present register: create_client_result loop: "{{ keycloak_clients | flatten }}" - when: keycloak_clients is defined + when: (item.name is defined and item.client_id is defined) or (item.name is defined and item.id is defined) - name: Create client roles include_tasks: manage_client_roles.yml diff --git a/roles/keycloak_realm/tasks/manage_client_roles.yml b/roles/keycloak_realm/tasks/manage_client_roles.yml index 85cf156..05df77f 100644 --- a/roles/keycloak_realm/tasks/manage_client_roles.yml +++ b/roles/keycloak_realm/tasks/manage_client_roles.yml @@ -3,7 +3,6 @@ name: "{{ item }}" realm: "{{ client.realm }}" client_id: "{{ client.name }}" - description: "{{ item.description | default(omit) }}" auth_client_id: "{{ keycloak_auth_client }}" auth_keycloak_url: "{{ keycloak_url }}/auth" auth_realm: "{{ keycloak_auth_realm }}"