-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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_user_federation is not idempotent #4664
Comments
Files identified in the description: If these files are incorrect, please update the |
I just came across this problem as well. |
Facing the same problem here.
|
Files identified in the description: If these files are incorrect, please update the |
I stumbled about this problem today and found the cause, or at least a cause. This is the request the module assembles under the hood to probe for existing user federations:
This calls always returns an empty list and will also do so when trying this manually by using curl or similar. The problem is the second query parameter: But quite frankly in my humble opinion the even better solution would be to completly remove the query param which also works fine. The parent is already part of the url path so repeating it as query param seems superfluous. But maybe api versions play a role here? Documentation for this module references keycloak api version However I will try to put a PR together which should fix this at least for recent versions of keycloak. Note: If someone wants to test if my proposed fix helps them one can test it by temporarly replacing
|
Okay, I played around a bit more and it seems the situation is unfortunately a bit more complicated than anticipated above. This would make this technically an upstream issue for keycloak rest api but I would still argue to remove the seemingly unnecessary dependency on this here in ansible to make it more robust against such kind of errors. |
Summary
When running the 'community.general.keycloak_user_federation' module it keeps adding more entries of ldap user federations every time it is run instead of recognizing it is already there.
At the same time if a mapper is defined and happens to be the same as one that already exists it just gets added as a second mapper instead of updating the one that is auto created.
If mappers are defined when creating a user federation it would be good to delete the mappers that are auto created as there is no good way to clean those up using this module.
Issue Type
Bug Report
Component Name
community.general.keycloak_user_federation
Ansible Version
Community.general Version
Configuration
the home paths are inconsistent due to redactions...
OS / Environment
Archlinux
Steps to Reproduce
Run this twice then check the keycloak ui and you will find two
freeipa3
entries and ansible will say changed both timesYou will also find that each entry contains two
first name
mappers when the first one should have been overwritten.Ideally you would only find the
full name
andfirst name
mappers but instead you will find multiple additional mappers for bothfreeipa3
user federation entries.Expected Results
One
freeipa3
user federation entry should exist, the defaultfirst name
mapper would be updated and mappers not listed in the above config would not be present.Actual Results
every time the module is run.
Code of Conduct
The text was updated successfully, but these errors were encountered: