community.general.keycloak_user 模块 – 在 Keycloak 中创建和配置用户
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查是否已安装它,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install community.general
。
要在 playbook 中使用它,请指定: community.general.keycloak_user
。
community.general 7.1.0 中的新增功能
概要
此模块创建、删除或更新 Keycloak 用户。
参数
参数 |
注释 |
---|---|
列出用户访问权限。 |
|
用户属性列表。 |
|
属性名称。 |
|
控制属性是否存在。 选项
|
|
属性的值列表。 |
|
用于使用 API 进行身份验证的 OpenID Connect 默认值: |
|
与 |
|
Keycloak 实例的 URL。 |
|
用于 API 访问身份验证的密码。 |
|
用于 API 访问身份验证的 Keycloak realm 名称。 |
|
用于 API 访问身份验证的用户名。 |
|
客户端身份验证类型。 默认值: |
|
客户端角色的客户端 ID。不是客户端的技术 ID。 |
|
要分配给用户的客户端角色列表。 |
|
控制到 Keycloak API 的 HTTP 连接超时时间(以秒为单位)。 默认值: |
|
用户凭据。 默认值: |
|
如果 选项
|
|
凭据类型。 |
|
凭据的值。 |
|
列出用户凭据类型。 默认值: |
|
用户邮箱。 |
|
检查用户邮箱的有效性。 选项
|
|
启用用户。 选项
|
|
用户的 IDP 列表。 默认值: |
|
联合链接。 |
|
用户的姓名。 |
|
如果 选项
|
|
用户的组列表。 默认值: |
|
组的名称。 |
|
控制用户是否必须是该组的成员。 选项
|
|
配置 HTTP User-Agent 标头。 默认值: |
|
如果已知,则为 Keycloak 服务器上用户的 ID。 |
|
用户的姓氏。 |
|
用户来源。 |
|
客户端所在的 realm 的名称。 默认值: |
|
RequiredActions 用户身份验证。 默认值: |
|
用户自我管理。 |
|
客户端应用程序的描述。 |
|
控制用户是否存在。 选项
|
|
Keycloak API 的身份验证令牌。 |
|
用户的用户名。 |
|
验证 TLS 证书(不要在生产环境中禁用此选项)。 选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持:完全支持 |
可以在 |
|
支持:完全支持 |
在差异模式下,将返回有关已更改内容(或可能需要在 |
备注
注意
此模块不会修改现有用户的用户 ID。
示例
- name: Create a user user1
community.general.keycloak_user:
auth_keycloak_url: https://127.0.0.1:8080/auth
auth_username: admin
auth_password: password
realm: master
username: user1
firstName: user1
lastName: user1
email: user1
enabled: true
emailVerified: false
credentials:
- type: password
value: password
temporary: false
attributes:
- name: attr1
values:
- value1
state: present
- name: attr2
values:
- value2
state: absent
groups:
- name: group1
state: present
state: present
- name: Re-create a User
community.general.keycloak_user:
auth_keycloak_url: https://127.0.0.1:8080/auth
auth_username: admin
auth_password: password
realm: master
username: user1
firstName: user1
lastName: user1
email: user1
enabled: true
emailVerified: false
credentials:
- type: password
value: password
temporary: false
attributes:
- name: attr1
values:
- value1
state: present
- name: attr2
values:
- value2
state: absent
groups:
- name: group1
state: present
state: present
- name: Re-create a User
community.general.keycloak_user:
auth_keycloak_url: https://127.0.0.1:8080/auth
auth_username: admin
auth_password: password
realm: master
username: user1
firstName: user1
lastName: user1
email: user1
enabled: true
emailVerified: false
credentials:
- type: password
value: password
temporary: false
attributes:
- name: attr1
values:
- value1
state: present
- name: attr2
values:
- value2
state: absent
groups:
- name: group1
state: present
state: present
force: true
- name: Remove User
community.general.keycloak_user:
auth_keycloak_url: https://127.0.0.1:8080/auth
auth_username: admin
auth_password: password
realm: master
username: user1
state: absent
返回值
常见的返回值已在此处记录,以下是此模块独有的字段
键 |
描述 |
---|---|
如果操作更改了 Keycloak 服务器上的用户,则返回 返回:始终返回 |
|
模块执行后用户的表示 返回:成功时返回 |
|
现有用户的表示。 返回:成功时返回 |
|
关于采取了什么操作的消息。 返回:始终返回 示例: |
|
建议用户的表示。 返回:成功时返回 |