mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2025-07-29 08:01:33 -07:00
User Federation changes
This commit is contained in:
parent
ead4688ce6
commit
247d8b8a22
6 changed files with 86 additions and 5 deletions
|
@ -14,6 +14,8 @@ Role Defaults
|
|||
|`keycloak_http_port` | HTTP port | `8080` |
|
||||
|`keycloak_https_port` | TLS HTTP port | `8443` |
|
||||
|`keycloak_auth_realm` | Name of the main authentication realm | `master` |
|
||||
|`keycloak_rhsso_enable` | Define service is an upstream(Keycloak) or RHSSO | `master` |
|
||||
|
||||
|
||||
|
||||
Role Variables
|
||||
|
@ -35,10 +37,29 @@ The following variables are available for creating clients:
|
|||
|`keycloak_client_default_roles` | List of default role name for clients | `[]` |
|
||||
|`keycloak_client_users` | List of user/role mappings for a client | `[]` |
|
||||
|
||||
The following variable are available for creating user federation:
|
||||
|
||||
| Variable | Description | Default |
|
||||
|:---------|:------------|:---------|
|
||||
|`keycloak_user_federation` | List of _keycloak_user_federation_ for the realm | `[]` |
|
||||
|
||||
|
||||
Variable formats
|
||||
----------------
|
||||
|
||||
* `keycloak_user_federation`, a list of:
|
||||
|
||||
```yaml
|
||||
- realm: <name of the realm in which user federation should be configured, required>
|
||||
name: <name of the user federation provider, required>
|
||||
provider_id: <Type of the user federation provider, required>
|
||||
provider_type: < Provider Type, default is set to org.keycloak.storage.UserStorageProvider>
|
||||
config: <Dictionary of supported configuration values, required>
|
||||
mappers: <List of supported configuration values, required>
|
||||
```
|
||||
|
||||
Refer to [docs](https://docs.ansible.com/ansible/latest/collections/community/general/keycloak_user_federation_module.html) for information on supported variables.
|
||||
|
||||
* `keycloak_clients`, a list of:
|
||||
|
||||
```yaml
|
||||
|
@ -71,7 +92,6 @@ Variable formats
|
|||
|
||||
For a comprehensive example, refer to the [playbook](playbooks/keycloak.yml).
|
||||
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@ keycloak_admin_user: admin
|
|||
keycloak_auth_realm: master
|
||||
keycloak_auth_client: admin-cli
|
||||
|
||||
### List of Keycloak User Federation
|
||||
keycloak_user_federation: []
|
||||
|
||||
### Keycloak realm client defaults
|
||||
# list of clients to create in the realm
|
||||
#
|
||||
|
|
|
@ -34,6 +34,24 @@
|
|||
status_code: 201
|
||||
when: keycloak_realm_exists.status == 404
|
||||
|
||||
- name: Create user federation
|
||||
community.general.keycloak_user_federation:
|
||||
auth_keycloak_url: "{{ keycloak_url }}/auth"
|
||||
auth_realm: "{{ keycloak_auth_realm }}"
|
||||
auth_username: "{{ keycloak_admin_user }}"
|
||||
auth_password: "{{ keycloak_admin_password }}"
|
||||
realm: "{{ item.realm }}"
|
||||
name: "{{ item.name }}"
|
||||
state: present
|
||||
provider_id: "{{ item.provider_id }}"
|
||||
provider_type: "{{ item.provider_type | default(org.keycloak.storage.UserStorageProvider) }}"
|
||||
config: "{{ item.config }}"
|
||||
mappers: "{{ item.mappers | default(omit) }}"
|
||||
register: create_user_federation_result
|
||||
loop: "{{ keycloak_user_federation | flatten }}"
|
||||
when: keycloak_user_federation is defined
|
||||
|
||||
|
||||
- name: Create Client
|
||||
community.general.keycloak_client:
|
||||
auth_client_id: "{{ keycloak_auth_client }}"
|
||||
|
|
|
@ -13,4 +13,4 @@ keycloak_clients:
|
|||
# other settings
|
||||
keycloak_url: "http://{{ keycloak_host }}:{{ keycloak_http_port }}"
|
||||
keycloak_management_url: "http://{{ keycloak_host }}:{{ keycloak_management_http_port }}"
|
||||
keycloak_rhsso_enable: "{{ True if rhsso_rhn_id is defined else False }}"
|
||||
keycloak_rhsso_enable: False
|
Loading…
Add table
Add a link
Reference in a new issue