community.general.ipa_otpconfig 模块 – 管理 FreeIPA OTP 配置设置

注意

此模块是 community.general 集合 (版本 10.1.0) 的一部分。

如果您正在使用 ansible 软件包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install community.general

要在 playbook 中使用它,请指定: community.general.ipa_otpconfig

community.general 2.5.0 中的新增功能

概要

  • 修改 FreeIPA 服务器关于 OTP(一次性密码)的全局配置设置。

参数

参数

注释

ipa_host

字符串

IPA 服务器的 IP 地址或主机名。

如果任务中未指定此值,则将使用环境变量 IPA_HOST 的值。

如果任务中既未指定环境变量 IPA_HOST,也未指定该值,则将使用 DNS 来尝试发现 FreeIPA 服务器。

FreeIPA 中需要的相关条目是 ipa-ca 条目。

如果 DNS 条目、环境变量 IPA_HOST 和任务中的值均不可用,则将使用默认值。

默认值: "ipa.example.com"

ipa_pass

字符串

管理员用户的密码。

如果任务中未指定此值,则将使用环境变量 IPA_PASS 的值。

请注意,如果 urllib_gssapi 库可用,则可以使用 GSSAPI 进行 FreeIPA 身份验证。

如果环境变量 KRB5CCNAME 可用,则模块将使用此 Kerberos 凭据缓存来对 FreeIPA 服务器进行身份验证。

如果环境变量 KRB5_CLIENT_KTNAME 可用,而 KRB5CCNAME 不可用;模块将使用此 Kerberos 密钥表进行身份验证。

如果 GSSAPI 不可用,则需要使用 ipa_pass

ipa_port

整数

FreeIPA/IPA 服务器的端口。

如果任务中未指定此值,则将使用环境变量 IPA_PORT 的值。

如果任务中既未指定环境变量 IPA_PORT,也未指定该值,则将设置默认值。

默认值: 443

ipa_prot

字符串

IPA 服务器使用的协议。

如果任务中未指定此值,则将使用环境变量 IPA_PROT 的值。

如果任务中既未指定环境变量 IPA_PROT,也未指定该值,则将设置默认值。

选项

  • "http"

  • "https" ← (默认)

ipa_timeout

整数

指定连接的空闲超时时间(以秒为单位)。

对于批量操作,您可能需要增加此值以避免 IPA 服务器超时。

如果任务中未指定此值,则将使用环境变量 IPA_TIMEOUT 的值。

如果任务中既未指定环境变量 IPA_TIMEOUT,也未指定该值,则将设置默认值。

默认值: 10

ipa_user

字符串

在 IPA 服务器上使用的管理员帐户。

如果任务中未指定此值,则将使用环境变量 IPA_USER 的值。

如果任务中未指定环境变量IPA_USER及其值,则将设置默认值。

默认值: "admin"

ipatokenhotpauthwindow

别名:hotpauthwindow

整数

HOTP 身份验证窗口(以跳数计)。

ipatokenhotpsyncwindow

别名:hotpsyncwindow

整数

HOTP 同步窗口(以跳数计)。

ipatokentotpauthwindow

别名:totpauthwindow

整数

TOTP 身份验证窗口(以秒计)。

ipatokentotpsyncwindow

别名:totpsyncwindow

整数

TOTP 同步窗口(以秒计)。

validate_certs

布尔值

这仅在ipa_prothttps 时适用。

如果设置为 false,则不会验证 SSL 证书。

仅应在使用自签名证书的个人控制站点上将其设置为 false

选项

  • false

  • true ← (默认)

属性

属性

支持

描述

check_mode

支持:完全支持

可以在 check_mode 下运行,并在不修改目标的情况下返回更改状态预测。

diff_mode

支持:不支持

在差异模式下,将返回有关已更改内容(或可能需要在 check_mode 中更改的内容)的详细信息。

示例

- name: Ensure the TOTP authentication window is set to 300 seconds
  community.general.ipa_otpconfig:
    ipatokentotpauthwindow: '300'
    ipa_host: localhost
    ipa_user: admin
    ipa_pass: supersecret

- name: Ensure the TOTP synchronization window is set to 86400 seconds
  community.general.ipa_otpconfig:
    ipatokentotpsyncwindow: '86400'
    ipa_host: localhost
    ipa_user: admin
    ipa_pass: supersecret

- name: Ensure the HOTP authentication window is set to 10 hops
  community.general.ipa_otpconfig:
    ipatokenhotpauthwindow: '10'
    ipa_host: localhost
    ipa_user: admin
    ipa_pass: supersecret

- name: Ensure the HOTP synchronization window is set to 100 hops
  community.general.ipa_otpconfig:
    ipatokenhotpsyncwindow: '100'
    ipa_host: localhost
    ipa_user: admin
    ipa_pass: supersecret

返回值

常见的返回值已在此处记录,以下是此模块特有的字段

描述

otpconfig

字典

IPA API 返回的 OTP 配置。

返回:始终返回

作者

  • justchris1 (@justchris1)