community.zabbix.zabbix_authentication 模块 – 更新 Zabbix 身份验证
注意
此模块是 community.zabbix 集合 (版本 3.2.0) 的一部分。
如果您使用的是 ansible 包,则您可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.zabbix。您需要其他要求才能使用此模块,请参阅 要求 以了解详情。
要在剧本中使用它,请指定:community.zabbix.zabbix_authentication。
community.zabbix 1.6.0 中的新增功能
概要
- 此模块允许您修改 Zabbix 身份验证设置。 
要求
执行此模块的主机需要以下要求。
- python >= 3.9 
参数
| 参数 | 注释 | 
|---|---|
| 选择默认身份验证类型。 选项 
 | |
| 要为取消预配的用户分配的用户组名称。 配置时,用户组必须被禁用,并且不能被启用或删除。 如果启用了  此参数自 Zabbix 6.4 起可用。 | |
| 如果为  选项 
 | |
| 如果为  选项 
 | |
| 选择默认登录表单。 选项 
 | |
| 基本身份验证密码 | |
| 基本身份验证登录名 | |
| 应从用户名中删除的域名列表。 | |
| 已登录用户的 JIT 预配请求之间的时间间隔。 接受秒和带有后缀的时间单位,支持月和年 (3600s,60m,1h,1d,1M,1y)。最小值为 1h。 仅适用于 LDAP 预配。 此参数自 Zabbix 6.4 起可用。 默认值:  | |
| 如果为  此参数自 Zabbix 6.4 起可用。 选项 
 | |
| LDAP 的基本 DN。 如果 ldap_configured 的当前值为  仅适用于 Zabbix <= 6.0,在更高版本中会被静默忽略。 | |
| LDAP 的绑定 DN。 仅适用于 Zabbix <= 6.0,在更高版本中会被静默忽略。 | |
| LDAP 的绑定密码。 仅适用于 Zabbix <= 6.0,在更高版本中会被静默忽略。 | |
| 如果为  选项 
 | |
| 如果为  仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 在 Zabbix 6.4 中移除 选项 
 | |
| LDAP 服务器名称。 例如  如果 ldap_configured 的当前值为  仅适用于 Zabbix <= 6.0,在更高版本中会被静默忽略。 | |
| LDAP 预配的状态。 此参数自 Zabbix 6.4 起可用。 选项 
 | |
| LDAP 服务器的端口号。 如果 ldap_configured 的当前值为  仅适用于 Zabbix <= 6.0,在更高版本中会被静默忽略。 | |
| LDAP 的搜索属性。 如果 ldap_configured 的当前值为  仅适用于 Zabbix <= 6.0,在更高版本中会被静默忽略。 | |
| 对于 gui_access 设置为 LDAP 或系统默认的用户组,LDAP 身份验证的默认用户目录名称。 当  | |
| 检查密码规则。 从  此参数自 Zabbix 6.0 起可用。 | |
| 密码的最小长度。 选择 1-70。 此参数自 Zabbix 6.0 起可用。 | |
| 如果为 选项 
 | |
| 如果为 选项 
 | |
| 如果为 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 选项 
 | |
| 如果为 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 选项 
 | |
| SAML 身份提供商的实体 ID。 如果saml_auth_enabled的当前值为 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 | |
| SAML 配置状态。 此参数自 Zabbix 6.4 起可用。 选项 
 | |
| SAML 服务提供商的名称标识符格式。 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 | |
| 如果为 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 选项 
 | |
| 如果为 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 选项 
 | |
| 如果为 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 选项 
 | |
| 如果为 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 选项 
 | |
| 如果为 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 选项 
 | |
| SAML 单点注销服务的 URL。 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 | |
| SAML 服务提供商的实体 ID。 如果saml_auth_enabled的当前值为 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 | |
| SAML 单点登录服务的 URL。 如果saml_auth_enabled的当前值为 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 | |
| SAML 的用户名属性。 如果saml_auth_enabled的当前值为 仅适用于 Zabbix <= 6.2,在更高版本中会被静默忽略。 | 
示例
# 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: Update all authentication setting (Zabbix <= 6.0)
  # 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_authentication:
    authentication_type: internal
    http_auth_enabled: true
    http_login_form: zabbix_login_form
    http_strip_domains:
      - comp
      - any
    http_case_sensitive: true
    ldap_configured: true
    ldap_host: "ldap://"
    ldap_port: 389
    ldap_base_dn: "ou=Users,ou=system"
    ldap_search_attribute: "uid"
    ldap_bind_dn: "uid=ldap_search,ou=system"
    ldap_case_sensitive: true
    ldap_bind_password: "password"
    saml_auth_enabled: true
    saml_idp_entityid: ""
    saml_sso_url: "https:///SAML2/SSO"
    saml_slo_url: "https:///SAML2/SLO"
    saml_username_attribute: "uid"
    saml_sp_entityid: "https://"
    saml_nameid_format: "urn:oasis:names:tc:SAML:2.0:nameid-format:entity"
    saml_sign_messages: true
    saml_sign_assertions: true
    saml_sign_authn_requests: true
    saml_sign_logout_requests: true
    saml_sign_logout_responses: true
    saml_encrypt_nameid: true
    saml_encrypt_assertions: true
    saml_case_sensitive: true
    passwd_min_length: 70
    passwd_check_rules:
      - contain_uppercase_and_lowercase_letters
      - contain_digits
      - contain_special_characters
      - avoid_easy_to_guess
- name: Update all authentication setting (Zabbix = 6.2)
  # 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_authentication:
    authentication_type: internal
    http_auth_enabled: true
    http_login_form: zabbix_login_form
    http_strip_domains:
      - comp
      - any
    http_case_sensitive: true
    ldap_configured: true
    ldap_case_sensitive: true
    saml_auth_enabled: true
    saml_idp_entityid: ""
    saml_sso_url: "https:///SAML2/SSO"
    saml_slo_url: "https:///SAML2/SLO"
    saml_username_attribute: "uid"
    saml_sp_entityid: "https://"
    saml_nameid_format: "urn:oasis:names:tc:SAML:2.0:nameid-format:entity"
    saml_sign_messages: true
    saml_sign_assertions: true
    saml_sign_authn_requests: true
    saml_sign_logout_requests: true
    saml_sign_logout_responses: true
    saml_encrypt_nameid: true
    saml_encrypt_assertions: true
    saml_case_sensitive: true
    passwd_min_length: 70
    passwd_check_rules:
      - contain_uppercase_and_lowercase_letters
      - contain_digits
      - contain_special_characters
      - avoid_easy_to_guess
- name: Update all authentication setting (Zabbix >= 6.4)
  # 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_authentication:
    authentication_type: internal
    http_auth_enabled: true
    http_login_form: zabbix_login_form
    http_strip_domains:
      - comp
      - any
    http_case_sensitive: true
    ldap_auth_enabled: true
    ldap_userdirectory: TestUserDirectory
    ldap_case_sensitive: true
    saml_auth_enabled: true
    saml_case_sensitive: true
    ldap_jit_status: true
    saml_jit_status: true
    jit_provision_interval: 1h
    disabled_usrgrp: Disabled
    passwd_min_length: 70
    passwd_check_rules:
      - contain_uppercase_and_lowercase_letters
      - contain_digits
      - contain_special_characters
      - avoid_easy_to_guess
返回值
常见的返回值已在此处记录,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 操作结果 返回:成功 示例: | 
