Files
2026-09-08 17:05:36 +02:00

17 lines
611 B
YAML

- name: Find exact top-level Keycloak group
ansible.builtin.uri:
url: "{{ kc_api }}/groups?search={{ kc_group_name | urlencode }}&exact=true&first=0&max=100&briefRepresentation=true"
headers: "{{ kc_headers }}"
register: kc_group_search
- name: Create missing top-level Keycloak group
ansible.builtin.uri:
url: "{{ kc_api }}/groups"
headers: "{{ kc_headers }}"
method: POST
body_format: json
body:
name: "{{ kc_group_name }}"
status_code: 201
when: kc_group_search.json | selectattr('path', 'equalto', '/' ~ kc_group_name) | list | length == 0
changed_when: true