community.zabbix.zabbix_mfa 模块 – 创建/更新/删除 Zabbix MFA 方法
注意
此模块是 community.zabbix 集合(版本 3.2.0)的一部分。
如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.zabbix。您需要进一步的要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:community.zabbix.zabbix_mfa。
community.zabbix 3.1.0 中的新增功能
概要
- 此模块允许您创建、更新和删除 Zabbix MFA 方法。 
要求
在执行此模块的主机上需要以下要求。
- python >= 3.11 
参数
| 参数 | 注释 | 
|---|---|
| Duo 身份验证服务提供的 API 主机名。 当  | |
| Duo 身份验证服务提供的客户端密钥。 当  | |
| Duo 身份验证服务提供的客户端 ID。 当  | |
| 验证码长度。 当  选项 
 | |
| 用于生成 TOTP 代码的哈希函数类型。 当  选项 
 | |
| 基本身份验证密码 | |
| 基本身份验证登录名 | |
| 此 MFA 方法的类型 选项 
 | |
| 此 MFA 方法的名称 | |
| 此 MFA 的状态。 选项 
 | 
说明
注意
- 仅支持 Zabbix >= 7.0。 
- 当 method_type 为 - duo_universal_prompt时,此模块返回 changed=true,因为 Zabbix API 不会返回任何敏感信息以供模块比较。
示例
# If you want to use Username and Password to be authenticated by Zabbix Server
- name: Set credentials to access Zabbix Server API
  ansible.builtin.set_fact:
    ansible_user: Admin
    ansible_httpapi_pass: zabbix
# If you want to use API token to be authenticated by Zabbix Server
# https://www.zabbix.com/documentation/current/en/manual/web_interface/frontend_sections/administration/general#api-tokens
- name: Set API token
  ansible.builtin.set_fact:
    ansible_zabbix_auth_key: 8ec0d52432c15c91fcafe9888500cf9a607f44091ab554dbee860f6b44fac895
- name: Create a 'Zabbix TOTP' MFA method
  # set task level variables as we change ansible_connection plugin here
  vars:
    ansible_network_os: community.zabbix.zabbix
    ansible_connection: httpapi
    ansible_httpapi_port: 443
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_zabbix_url_path: 'zabbixeu'  # If Zabbix WebUI runs on non-default (zabbix) path ,e.g. http://<FQDN>/zabbixeu
    ansible_host: zabbix-example-fqdn.org
  community.zabbix.zabbix_mfa:
    name: Zabbix TOTP
    method_type: totp
    hash_function: sha-1
    code_length: 6
返回值
常见的返回值记录在此处,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 创建操作的结果 返回: 成功 示例:  | 
