theforeman.foreman.auth_source_ldap 模块 – 管理 LDAP 身份验证源
注意
此模块是 theforeman.foreman 集合(版本 4.2.0)的一部分。
如果您正在使用 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用: ansible-galaxy collection install theforeman.foreman。您需要更多要求才能使用此模块,请参阅 要求了解详细信息。
要在 playbook 中使用它,请指定:theforeman.foreman.auth_source_ldap。
theforeman.foreman 1.0.0 中的新功能
概要
- 创建、更新和删除 LDAP 身份验证源 
别名:foreman_auth_source_ldap
要求
执行此模块的主机上需要以下要求。
- requests 
参数
| 参数 | 注释 | 
|---|---|
| 访问 LDAP 服务器时使用的帐户名称。 | |
| 访问 LDAP 服务器时使用的帐户密码。 使用 onthefly_register 时必需。 设置此参数后,模块将不是幂等的。 | |
| 包含名字的属性。 使用 onthefly_register 时必需。 | |
| 包含姓氏的属性。 使用 onthefly_register 时必需。 | |
| 包含登录 ID 的属性。 使用 onthefly_register 时必需。 | |
| 包含电子邮件地址的属性。 使用 onthefly_register 时必需。 | |
| 包含用户照片的属性 | |
| 搜索时使用的基本 DN。 | |
| 组所在的基本 DN。 | |
| LDAP 服务器的主机名 | |
| 应用于 LDAP 搜索的过滤器 | |
| 实体应分配到的位置列表 | |
| LDAP 身份验证源的名称 | |
| 是否动态注册用户。 选择 
 | |
| 实体应分配到的组织列表 | |
| 访问 Foreman 服务器的用户的密码。 如果任务中未指定该值,则将改用环境变量  | |
| LDAP 服务器的端口号 默认值:  | |
| LDAP 服务器的类型 选择 
 | |
| Foreman 服务器的 URL。 如果任务中未指定该值,则将改用环境变量  | |
| 实体的状态 选择 
 | |
| 是否在联系 LDAP 服务器时使用 TLS。 选择 
 | |
| 是否使用 NIS 网络组而不是 posix 组,对于 server_type=active_directory 无效 选择 
 | |
| 是否在登录时同步外部用户组 选择 
 | |
| 访问 Foreman 服务器的用户名。 如果任务中未指定该值,则将改用环境变量  | |
| 是否验证 Foreman 服务器的 TLS 证书。 如果任务中未指定该值,则将改用环境变量  选择 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全 | 可以在 check_mode 中运行并返回更改的状态预测,而无需修改实体 | |
| 支持:完全 | 在 diff 模式下,将返回已更改(或可能需要在 check_mode 中更改)的详细信息 | 
示例
- name: Simple FreeIPA authentication source
  theforeman.foreman.auth_source_ldap:
    name: "Example LDAP"
    host: "ldap.example.org"
    server_url: "https://foreman.example.com"
    locations:
      - "Uppsala"
    organizations:
      - "Sweden"
    username: "admin"
    password: "changeme"
    state: present
- name: FreeIPA with automatic registration
  theforeman.foreman.auth_source_ldap:
    name: "Example LDAP"
    host: "ldap.example.org"
    onthefly_register: true
    account: uid=ansible,cn=sysaccounts,cn=etc,dc=example,dc=com
    account_password: secret
    base_dn: dc=example,dc=com
    groups_base: cn=groups,cn=accounts, dc=example,dc=com
    server_type: free_ipa
    attr_login: uid
    attr_firstname: givenName
    attr_lastname: sn
    attr_mail: mail
    attr_photo: jpegPhoto
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
- name: Active Directory with automatic registration
  theforeman.foreman.auth_source_ldap:
    name: "Example AD"
    host: "ad.example.org"
    onthefly_register: true
    account: EXAMPLE\ansible
    account_password: secret
    base_dn: cn=Users,dc=example,dc=com
    groups_base: cn=Users,dc=example,dc=com
    server_type: active_directory
    attr_login: sAMAccountName
    attr_firstname: givenName
    attr_lastname: sn
    attr_mail: mail
    ldap_filter: (memberOf=CN=Domain Users,CN=Users,DC=example,DC=com)
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
返回值
常见的返回值记录在此处,以下是此模块独有的字段
| 键 | 描述 | 
|---|---|
| 受影响实体的最终状态,按其类型分组。 返回:成功 | |
| 用于 LDAP 的身份验证源列表。 返回:成功 | 
