Keycloak 26.8 added an autoRedirect field to the organization domain
representation. The module compared its own {name, verified} domain
list with the server's {autoRedirect, name, verified} list, so on 26.8
it reported changed on every run, re-sent the organization each time
and reset an autoRedirect value set outside the module.
Overlay the requested domain settings on the domains returned by the
server before comparing. Fields the module does not manage are now kept
as they are, both for the comparison and for the update request.
Behaviour against Keycloak 26.7 and earlier is unchanged.
Keycloak can require a user profile attribute only when one of the given
client scopes is requested, but the module's argument spec only accepted
required.roles and rejected required.scopes.
Check mode compared the realm returned by Keycloak with a plain
dict.update() of the module parameters. Keycloak stores attributes,
browserSecurityHeaders and smtpServer as string maps, merges attributes
and browserSecurityHeaders into the existing values and masks the SMTP
password, so the comparison never matched and check mode always
reported a change while a live run reported ok.
Predict the realm Keycloak would return for those maps in check mode
and add molecule checks for unchanged and changed settings.
Fixes#447
Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
In check mode, the desired group memberships were built as a set and
compared with the stored memberships, a list, through is_struct_included().
It has no branch for sets and falls back to comparing their string forms,
which never match, so check mode reported a change for every existing user,
with or without groups.
Check mode now decides like normal mode: a group given by name or by path
counts as joined when the user is already a member. That rule moves from
update_user_groups_membership() into
filter_groups_to_add_to_and_remove_from_user(), which both modes use, and
the groups reported in check mode no longer list a group given by path
twice. Add check mode tests, including groups given by path.
Fixes#442
Signed-off-by: Filipe Rosa Capela <Filipe.Capela-CIC.Netherlands1@ibm.com>
Keycloak 26 introduced Organizations as a stable feature for B2B
multi-tenancy within a single realm. This adds declarative Ansible
module support so organizations can be managed like other Keycloak
resources instead of requiring direct REST API calls.
New modules:
- keycloak_organization: CRUD for organizations with full check_mode,
diff_mode, and idempotency support. Manages name, alias, description,
enabled state, domains, and attributes.
- keycloak_organization_info: read-only module to list/search
organizations by name with exact or partial matching.
Also adds 6 API methods to the KeycloakAPI class and comprehensive
Molecule integration tests covering create, idempotency, update,
info queries, attributes, and delete flows.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The collection was missing modules for managing client scopes and
authentication flows, forcing users to write raw uri calls against
the Keycloak Admin REST API. This adds two new modules that leverage
the existing KeycloakAPI helper methods:
- keycloak_client_scope: create/update/delete client scopes with
protocol mappers (supports check_mode and diff)
- keycloak_authentication_flow: create/delete authentication flows
with execution steps, or copy existing flows (supports check_mode
and diff)
Also adds three example playbooks using the new modules:
- keycloak_client_scope.yml
- keycloak_authentication_flow.yml
- keycloak_realm_client.yml
Made-with: Cursor