netapp.ontap.na_ontap_info 模块 – NetApp 信息收集器

注意

此模块是 netapp.ontap 集合 (版本 22.13.0) 的一部分。

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

要安装它,请使用:ansible-galaxy collection install netapp.ontap。您需要其他要求才能使用此模块,有关详细信息,请参阅 需求

要在 playbook 中使用它,请指定:netapp.ontap.na_ontap_info

netapp.ontap 2.9.0 中的新增功能

概要

  • 此模块允许您收集有关 ONTAP 配置的各种信息

需求

执行此模块的主机需要以下要求。

  • 物理或虚拟集群式 Data ONTAP 系统,模块支持 Data ONTAP 9.1 及更高版本,REST 支持需要 ONTAP 9.6 或更高版本。

  • Ansible 2.9 或更高版本 - 建议使用 2.12 或更高版本。

  • Python3 - 建议使用 3.9 或更高版本。

  • 使用 ZAPI 时,netapp-lib 2018.11.13 或更高版本(使用“pip install netapp-lib”安装),强烈建议使用 netapp-lib 2020.3.12,因为它可以为连接问题提供更好的错误报告。

  • netapp_lib

参数

参数

注释

cert_filepath

字符串

netapp.ontap 20.6.0 中添加

SSL 客户端证书文件(.pem)的路径。

python 2.6 不支持。

continue_on_error

列表 / 元素=字符串

默认情况下,此模块在第一个错误时失败。

此选项允许提供不会使模块失败的错误列表。

列表中的错误会在输出中(在相关的 info 元素下)作为“错误”条目报告。

可能的值为 always、never、missing_vserver_api_error、rpc_error、other_error。

missing_vserver_api_error - 最有可能的是 API 在集群级别可用,但在 vserver 级别不可用。

rpc_error - 某些查询失败,因为节点无法到达集群中的另一个节点。

key_error - 查询失败,因为返回的数据不包含预期的键。

对于键错误,请确保在 Discord 中报告此问题。这可能是新 ONTAP 版本中的更改。

other_error - 上述列表中未包含的任何内容。

always 将继续处理任何错误,never 将在任何错误时失败,它们不能与任何其他关键字一起使用。

默认值: ["never"]

desired_attributes

字典

netapp.ontap 20.6.0 中添加

需要理解 ZAPI 内部结构的高级功能。

允许请求默认情况下不返回的特定属性,或限制返回的属性。

zapi desired-attributes 元素的字典。

XML 标记 <tag>value</tag> 是一个字典,其中 tag 作为键。

Value 可以是另一个字典、字典列表、字符串或空值。

例如 <tag/> 表示为 tag:

如果设置了此选项,则一次只能调用一个子集。

确保关键属性位于正确位置是调用者的责任。

如果缺少任何关键属性,模块将出错。

feature_flags

字典

netapp.ontap 20.5.0 中添加

启用或禁用新功能。

这可以用于启用实验性功能或禁用破坏向后兼容性的新功能。

支持的键和值可能会随时更改,恕不另行通知。未知键将被忽略。

gather_subset

列表 / 元素=字符串

提供此参数时,此参数将收集的信息限制为给定的子集。此参数的可能值为

active_directory_account_info

aggregate_info

aggr_efficiency_info

autosupport_check_info

cifs_options_info

cifs_server_info

cifs_share_info

cifs_vserver_security_info

cluster_identity_info

cluster_image_info

cluster_log_forwarding_info

cluster_node_info

cluster_peer_info

cluster_switch_info

clock_info

disk_info

env_sensors_info

event_notification_destination_info

event_notification_info

export_policy_info

export_rule_info

fcp_adapter_info

fcp_alias_info

fcp_service_info

igroup_info

iscsi_service_info

job_schedule_cron_info

kerberos_realm_info

ldap_client

ldap_config

license_info

lun_info

lun_map_info

metrocluster_check_info

metrocluster_info

metrocluster_node_info

net_dev_discovery_info

net_dns_info

net_failover_group_info

net_firewall_info

net_ifgrp_info

net_interface_info

net_interface_service_policy_info

net_ipspaces_info

net_port_info

net_port_broadcast_domain_info

net_routes_info

net_vlan_info

nfs_info

ntfs_dacl_info

ntfs_sd_info

ntp_server_info

nvme_info

nvme_interface_info

nvme_namespace_info

nvme_subsystem_info

ontap_system_version

ontap_version

ontapi_version

qos_adaptive_policy_info

qos_policy_info

qtree_info

quota_policy_info

quota_report_info

role_info

security_key_manager_key_info

security_login_account_info

security_login_role_config_info

security_login_role_info

service_processor_info

service_processor_network_info

shelf_info

sis_info

sis_policy_info

snapmirror_info

snapmirror_destination_info

snapmirror_policy_info

snapshot_info

snapshot_policy_info

storage_failover_info

storage_bridge_info

subsys_health_info

sysconfig_info

sys_cluster_alerts

volume_info

volume_space_info

vscan_info

vscan_status_info

vscan_scanner_pool_info

vscan_connection_status_all_info

vscan_connection_extended_stats_info

vserver_info

vserver_login_banner_info

vserver_motd_info

vserver_nfs_info

vserver_peer_info

可以指定一个值列表来包含更大的子集。

值也可以与初始的!一起使用,以指定不应收集特定的子集。

从ONTAP 9.4版本开始支持nvme。

使用“help”获取系统支持信息的列表。

使用lun_info时,如果存在serial_number,则计算serial_hex和naa_id。

默认值: ["all"]

主机名

字符串 / 必需

ONTAP实例的主机名或IP地址。

http_port

整数

使用此端口覆盖默认端口(80或443)。

https

布尔值

启用和禁用https。

使用REST时忽略,因为仅支持https。

使用SSL证书认证时忽略,因为它需要SSL。

选项

  • false ← (默认)

  • true

key_filepath

字符串

netapp.ontap 20.6.0 中添加

SSL客户端密钥文件的路径。

max_records

整数

在netapp.ontap 20.2.0中添加

在单个ZAPI调用中返回的记录最大数量。有效范围是[1..2^32-1]。此参数控制此模块的内部行为。

默认值: 1024

ontapi

整数

要使用的ontap api版本

密码

别名:pass

字符串

指定用户的密码。

query

字典

在netapp.ontap 20.7.0中添加

需要理解 ZAPI 内部结构的高级功能。

允许指定要返回的对象。

zapi查询元素的字典。

XML 标记 <tag>value</tag> 是一个字典,其中 tag 作为键。

Value 可以是另一个字典、字典列表、字符串或空值。

例如 <tag/> 表示为 tag:

如果设置了此选项,则一次只能调用一个子集。

state

字符串

自21.1.0版本起已弃用。

此选项被忽略,并将继续被忽略。

summary

布尔值

在netapp.ontap 20.4.0中添加

布尔标志,用于控制返回模块信息的全部属性还是仅返回名称。

如果为true,则仅返回名称。

选项

  • false ← (默认)

  • true

use_native_zapi_tags

布尔值

netapp.ontap 20.6.0 中添加

默认情况下,返回字典键中的-将转换为_

如果设置为true,则禁用转换。

选项

  • false ← (默认)

  • true

use_rest

字符串

此模块仅支持ZAPI,不能切换到REST。

never – 如果模块支持ZAPI,则始终使用ZAPI。如果ZAPI不支持REST选项,则可能会发出错误。

auto – 将始终使用ZAPI。

默认值: "never"

用户名

别名:user

字符串

这可以是集群范围或SVM范围的帐户,具体取决于是否需要集群级或SVM级API。

更多信息,请阅读文档 https://mysupport.netapp.com/NOW/download/software/nmsdk/9.4/

支持两种身份验证方法

  1. 基本身份验证,使用用户名和密码;

  2. SSL证书身份验证,使用ssl客户端证书文件,以及可选的私钥文件。

要使用证书,必须已在ONTAP集群中安装证书,并且必须已启用证书身份验证。

validate_certs

布尔值

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

这应该只在使用自签名证书的个人控制站点上设置为False

选项

  • false

  • true ← (默认)

volume_move_target_aggr_info

字典

netapp.ontap 20.5.0 中添加

volume_move_target_aggr_info的必需选项

volume_name

字符串 / 必需

netapp.ontap 20.5.0 中添加

获取目标aggr信息的卷名称

vserver

字符串 / 必需

netapp.ontap 20.5.0 中添加

卷所在的vserver

vserver

字符串

在netapp.ontap 19.11.0中添加

如果存在,则“vserver隧道”将输出限制为vserver范围。

请注意,并非所有子集都支持vserver,并且“all”将触发错误。

注释

注意

  • 以na_ontap为前缀的模块旨在支持ONTAP存储平台。

  • 默认情况下启用https,并建议使用。要在集群上启用http,您必须运行以下命令“set -privilege advanced;”“system services web modify -http-enabled true;”。

示例

- name: Get NetApp info as Cluster Admin (Password Authentication)
  netapp.ontap.na_ontap_info:
    hostname: "na-vsim"
    username: "admin"
    password: "admins_password"
  register: ontap_info
- debug:
    msg: "{{ ontap_info.ontap_info }}"

- name: Get NetApp version as Vserver admin
  netapp.ontap.na_ontap_info:
    hostname: "na-vsim"
    username: "vsadmin"
    vserver: trident_svm
    password: "vsadmins_password"

- name: run ontap info module using vserver tunneling and ignoring errors
  netapp.ontap.na_ontap_info:
    hostname: "na-vsim"
    username: "admin"
    password: "admins_password"
    vserver: trident_svm
    summary: true
    continue_on_error:
      - missing_vserver_api_error
      - rpc_error

- name: Limit Info Gathering to Aggregate Information as Cluster Admin
  netapp.ontap.na_ontap_info:
    hostname: "na-vsim"
    username: "admin"
    password: "admins_password"
    gather_subset: "aggregate_info"
  register: ontap_info

- name: Limit Info Gathering to Volume and Lun Information as Cluster Admin
  netapp.ontap.na_ontap_info:
    hostname: "na-vsim"
    username: "admin"
    password: "admins_password"
    gather_subset:
      - volume_info
      - lun_info
  register: ontap_info

- name: Gather all info except for volume and lun information as Cluster Admin
  netapp.ontap.na_ontap_info:
    hostname: "na-vsim"
    username: "admin"
    password: "admins_password"
    gather_subset:
      - "!volume_info"
      - "!lun_info"
  register: ontap_info

- name: Gather Volume move information for a specific volume
  netapp.ontap.na_ontap_info:
    hostname: "na-vsim"
    username: "admin"
    password: "admins_password"
    gather_subset: volume_move_target_aggr_info
    volume_move_target_aggr_info:
      volume_name: carchitest
      vserver: ansible

- name: run ontap info module for aggregate module, requesting specific fields
  netapp.ontap.na_ontap_info:
    # <<: *login
    gather_subset: aggregate_info
    desired_attributes:
      aggr-attributes:
      aggr-inode-attributes:
        files-private-used:
      aggr-raid-attributes:
        aggregate-type:
    use_native_zapi_tags: true
    register: ontap
- debug: var=ontap

- name: run ontap info to get offline volumes with dp in the name
  netapp.ontap.na_ontap_info:
    # <<: *cert_login
    gather_subset: volume_info
    query:
      volume-attributes:
        volume-id-attributes:
          name: '*dp*'
        volume-state-attributes:
          state: offline
    desired_attributes:
      volume-attributes:
        volume-id-attributes:
          name:
        volume-state-attributes:
          state:
  register: ontap
- debug: var=ontap

返回值

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

描述

ontap_info

字典

返回有关NetApp集群配置的各种信息

返回:始终

示例: "{ \"ontap_info\": { \"active_directory_account_info\": {...}, \"aggregate_info\": {...}, \"autosupport_check_info\": {...}, \"cluster_identity_info\": {...}, \"cluster_image_info\": {...}, \"cluster_node_info\": {...}, \"igroup_info\": {...}, \"iscsi_service_info\": {...}, \"license_info\": {...}, \"lun_info\": {...}, \"metrocluster_check_info\": {...}, \"metrocluster_info\": {...}, \"metrocluster_node_info\": {...}, \"net_dns_info\": {...}, \"net_ifgrp_info\": {...}, \"net_interface_info\": {...}, \"net_interface_service_policy_info\": {...}, \"net_port_info\": {...}, \"ontap_system_version\": {...}, \"ontap_version\": {...}, \"ontapi_version\": {...}, \"qos_policy_info\": {...}, \"qos_adaptive_policy_info\": {...}, \"qtree_info\": {...}, \"quota_policy_info\": {..}, \"quota_report_info\": {...}, \"security_key_manager_key_info\": {...}, \"security_login_account_info\": {...}, \"snapmirror_info\": {...} \"snapmirror_destination_info\": {...} \"storage_bridge_info\": {...} \"storage_failover_info\": {...}, \"volume_info\": {...}, \"vserver_login_banner_info\": {...}, \"vserver_motd_info\": {...}, \"vserver_info\": {...}, \"vserver_nfs_info\": {...}, \"vscan_status_info\": {...}, \"vscan_scanner_pool_info\": {...}, \"vscan_connection_status_all_info\": {...}, \"vscan_connection_extended_stats_info\": {...} }"

作者

  • Piotr Olczak (@dprts)