keycloak_clientscope_type – Set the type of aclientscope in realm or client using Keycloak API
Note
This module is part of the middleware_automation.keycloak collection.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install middleware_automation.keycloak.
To use it in a playbook, specify: middleware_automation.keycloak.keycloak_clientscope_type.
New in middleware_automation.keycloak 3.0.0
Synopsis
This module allows you to set the type (optional, default) of clientscopes using the Keycloak REST API. It requires access to the REST API using OpenID Connect; the user connecting and the client being used must have the requisite access rights. In a default Keycloak installation, admin-cli and an admin user would work, as would a separate client definition with the scope tailored to your needs and a user having the expected roles.
Parameters
Parameter |
Comments |
|---|---|
OpenID Connect client_id to authenticate to the API with. Default: |
|
Client Secret to use in conjunction with auth_client_id (if required). |
|
URL to the Keycloak instance. |
|
Password to authenticate for API access with. |
|
Keycloak realm name to authenticate to for API access. |
|
Username to authenticate for API access with. |
|
The |
|
Controls the HTTP connections timeout period (in seconds) to Keycloak API. Default: |
|
Client scopes that should be of type default. |
|
Configures the HTTP User-Agent header. Default: |
|
Client scopes that should be of type optional. |
|
The Keycloak realm. Default: |
|
Authentication refresh token for Keycloak API. |
|
Authentication token for Keycloak API. |
|
Verify TLS certificates (do not disable this in production). Choices:
|
Attributes
Attribute |
Support |
Description |
|---|---|---|
Action group: middleware_automation.keycloak.keycloak added in middleware_automation.keycloak 3.0.0 |
Use |
|
Support: full |
Can run in |
|
Support: full |
Will return details on what has changed (or possibly needs changing in |
Examples
- name: Set default client scopes on realm level
middleware_automation.keycloak.keycloak_clientscope_type:
auth_client_id: admin-cli
auth_keycloak_url: https://auth.example.com
auth_realm: master
auth_username: USERNAME
auth_password: PASSWORD
realm: "MyCustomRealm"
default_clientscopes: ['profile', 'roles']
delegate_to: localhost
- name: Set default and optional client scopes on client level with token auth
middleware_automation.keycloak.keycloak_clientscope_type:
auth_client_id: admin-cli
auth_keycloak_url: https://auth.example.com
token: TOKEN
realm: "MyCustomRealm"
client_id: "MyCustomClient"
default_clientscopes: ['profile', 'roles']
optional_clientscopes: ['phone']
delegate_to: localhost
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Representation of client scopes after module execution. The sample is truncated. Returned: on success Sample: |
|
Representation of client scopes before module execution. Returned: always Sample: |
|
Message as to what action was taken. Returned: always Sample: |
|
Representation of proposed client-scope types mapping. Returned: always Sample: |