Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

community.general.keycloak_group: Unable to create/update more than 10 sub groups #9690

Open
1 task done
FabienSalles opened this issue Feb 4, 2025 · 2 comments · May be fixed by #9692
Open
1 task done

community.general.keycloak_group: Unable to create/update more than 10 sub groups #9690

FabienSalles opened this issue Feb 4, 2025 · 2 comments · May be fixed by #9692
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)

Comments

@FabienSalles
Copy link

Summary

When we want to create or update a sub-group, we fetch children of the parent group to know which sub group exist and should be updated.
The API is paginated by default with a maximum of 10 result and the api call does not set the corresponding paremeter.

So, when we try to create more than 10 sub-groups, we have the error : Sibling group named '...' already exists.

Issue Type

Bug Report

Component Name

community.general.keycloak_group

Ansible Version

ansible --version
ansible [core 2.16.3]

Community.general Version

Collection        Version
----------------- -------
community.general 10.2.0

I do not use the latest version because i have another issue with roles (#9678) but the error is also present on the latest version

Configuration

ansible-config dump --only-changed
CONFIG_FILE() = None
PAGER(env: PAGER) = less

OS / Environment

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.1 LTS
Release:	24.04
Codename:	noble

Steps to Reproduce

Create more than 10 subgroups

---
- name: Create ROOT Group
  community.general.keycloak_group:
    auth_client_id: admin-cli
    auth_keycloak_url: "keycloak_base_url"
    auth_realm: master
    auth_username: "keycloak_admin_username"
    auth_password: "keycloak_admin_password"
    realm: "master"
    name: "parent_group"

- name: Create SUB Groups
  community.general.keycloak_group:
    auth_client_id: admin-cli
    auth_keycloak_url: "keycloak_base_url"
    auth_realm: master
    auth_username: "keycloak_admin_username"
    auth_password: "keycloak_admin_password"
    state: present
    realm: "master"
    name: "{{ group.name }}"
    parents:
      - name: "parent_group"
  loop: 
     - name: SUB_GROUP_1
     - name: SUB_GROUP_2
     - name: SUB_GROUP_3
     - name: SUB_GROUP_4
     - name: SUB_GROUP_5
     - name: SUB_GROUP_6
     - name: SUB_GROUP_7
     - name: SUB_GROUP_8
     - name: SUB_GROUP_9
     - name: SUB_GROUP_10
     - name: SUB_GROUP_11
  loop_control:
    loop_var: group

Expected Results

Do not block and create conflict when we want to create more than 10 children.

Actual Results

failed: [keycloak_host] (item={'name': 'MY_CHILDREN', 'parent': 'parent_group'}) => {"ansible_loop_var": "group", "changed": false, "group": {"name": "MY_CHILDREN", "parent": "parent_group"}, "msg": "Could not create subgroup MY_CHILDREN for parent group cc1df29f-77cc-4ced-935e-3641d36667f8 in realm master: HTTP Error 409: Conflict: {\"errorMessage\":\"Sibling group named 'MY_CHILDREN' already exists.\"}"}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) labels Feb 4, 2025
FabienSalles added a commit to FabienSalles/ansible-community.general that referenced this issue Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants