Skip to content

community.keycloak_user module fails with conflict #10103

Open
@Pearmint

Description

@Pearmint

Summary

When using community.keycloak_user (version 9.5.7) the create user module fails if there is already a user created with the same username. Also the force parameter does not work.

The returned 409 conflict is interpreted as failure.

Issue Type

Bug Report

Component Name

keycloak_user

Ansible Version

$ ansible --version

ansible [core 2.16.0]

Community.general Version

$ ansible-galaxy collection list community.general


Collection        Version
----------------- -------
community.general 9.4.0  

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

---
- name: Create Testuser
  community.general.keycloak_user:
    auth_keycloak_url: http://localhost:8080/
    auth_username: admin
    auth_password: adminpassword
    auth_realm: master
    realm: admin
    username: testuser
    firstName: Testuser
    lastName: for Testing
    email: [email protected]
    enabled: true
    emailVerified: false
    credentials:
      - type: password
        value: "password"
        temporary: false
    state: present

Expected Results

I should succeed without changing anything (if userdata is unchanged).

Actual Results

TASK [keycloak : Create Testuser] ***************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Could not create user testuser in realm admin: HTTP Error 409: Conflict: {\"errorMessage\":\"User exists with same username\"}"}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bugmodulemodulepluginsplugin (any type)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions