cisco.nxos.nxos_facts 模块 – 获取关于 NX-OS 交换机的信息

注意

此模块是 cisco.nxos 集合(版本 9.2.1)的一部分。

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

要安装它,请使用:ansible-galaxy collection install cisco.nxos

要在剧本中使用它,请指定:cisco.nxos.nxos_facts

cisco.nxos 1.0.0 中的新功能

概要

  • 从运行 NX-OS 操作系统的 Cisco Nexus 设备收集信息。通过 network_clihttpapi 都支持信息收集。此模块将所有基本网络信息键加上前缀 ansible_net_<fact>。信息模块将始终从设备收集基本信息集,并且可以启用或禁用其他信息的收集。

参数

参数

注释

available_network_resources

布尔值

当设置为 true 时,将提供可用资源模块的网络资源列表。

选项

  • false ← (默认)

  • true

gather_network_resources

列表 / 元素=字符串

当提供此参数时,将仅收集给定子集的配置信息。可以指定一个值列表以包含更大的子集。值也可以与初始 ! 一起使用,以指定不应收集特定的子集。

有效的子集为 all, bfd_interfaces, lag_interfaces, telemetry, vlans, lacp, lacp_interfaces, interfaces, l3_interfaces, l2_interfaces, lldp_global, acls, acl_interfaces, ospfv2, ospfv3, ospf_interfaces, bgp_global, bgp_address_family, route_maps, prefix_lists, logging_global, ntp_global, snmp_server, hostname

gather_subset

列表 / 元素=字符串

当提供此参数时,将仅收集给定子集的操作信息。此参数的可能值包括 all, hardware, config, legacy, interfacesmin。可以指定一个值列表以包含更大的子集。值也可以与初始 ! 一起使用,以指定不应收集特定的子集。

默认值: ["min"]

注释

注意

  • 在 VIRL 上针对 NXOSv 7.3.(0)D1(1) 进行了测试

  • 不支持 Cisco MDS

  • 有关使用 CLI 和 NX-API 的信息,请参阅 :ref:`NXOS 平台选项指南 <nxos_platform_options>`

  • 有关使用 Ansible 管理网络设备的更多信息,请参阅 :ref:`Ansible 网络指南 <network_guide>`

  • 有关使用 Ansible 管理 Cisco 设备的更多信息,请参阅 `Cisco 集成页面 <https://ansible.org.cn/integrations/networks/cisco>`_。

示例

- name: Gather all legacy facts
  cisco.nxos.nxos_facts:
    gather_subset: all
- name: Gather only the config and default facts
  cisco.nxos.nxos_facts:
    gather_subset:
      - config
- name: Do not gather hardware facts
  cisco.nxos.nxos_facts:
    gather_subset:
      - '!hardware'
- name: Gather legacy and resource facts
  cisco.nxos.nxos_facts:
    gather_subset: all
    gather_network_resources: all
- name: Gather only the interfaces resource facts and no legacy facts
  cisco.nxos.nxos_facts:
    gather_subset:
      - '!all'
      - '!min'
    gather_network_resources:
      - interfaces
- name: Gather interfaces resource and minimal legacy facts
  cisco.nxos.nxos_facts:
    gather_subset: min
    gather_network_resources: interfaces

返回值

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

描述

ansible_net_all_ipv4_addresses

列表 / 元素=字符串

设备上配置的所有 IPv4 地址

已返回: 当配置 interfaces 时

ansible_net_all_ipv6_addresses

列表 / 元素=字符串

设备上配置的所有 IPv6 地址

已返回: 当配置 interfaces 时

ansible_net_api

字符串

传输的名称

已返回: 始终

ansible_net_config

字符串

设备中的当前活动配置

已返回: 当配置 config 时

ansible_net_filesystems

列表 / 元素=字符串

设备上所有可用的文件系统名称

已返回: 当配置 hardware 时

ansible_net_gather_network_resources

列表 / 元素=字符串

从设备收集的网络资源子集的事实列表

返回: 当资源被配置时

ansible_net_gather_subset

列表 / 元素=字符串

从设备收集的事实子集列表

已返回: 始终

ansible_net_hostname

字符串

设备的已配置主机名

已返回: 始终

ansible_net_image

字符串

设备正在运行的镜像文件

已返回: 始终

ansible_net_interfaces

字典

系统中所有正在运行的接口的哈希值

已返回: 当配置 interfaces 时

ansible_net_license_hostid

字符串

设备的许可证主机ID

已返回: 始终

ansible_net_memfree_mb

整数

远程设备上可用的空闲内存,单位为 Mb

已返回: 当配置 hardware 时

ansible_net_memtotal_mb

整数

远程设备上的总内存,单位为 Mb

已返回: 当配置 hardware 时

ansible_net_model

字符串

从设备返回的型号名称

已返回: 始终

ansible_net_neighbors

字典

来自设备的LLDP和CDP邻居列表。如果一个端口上同时存在CDP和LLDP邻居数据,则优先使用CDP。

已返回: 当配置 interfaces 时

ansible_net_python_version

字符串

Ansible 控制器正在使用的 Python 版本

已返回: 始终

ansible_net_serialnum

字符串

远程设备的序列号

已返回: 始终

ansible_net_version

字符串

远程设备上运行的操作系统版本

已返回: 始终

fan_info

字典

关于远程设备中风扇的事实的哈希值

返回: 当配置了 legacy 时

hostname

字典

远程设备的已配置主机名

返回: 当配置了 legacy 时

interfaces_list

字典

远程设备上的接口名称列表

返回: 当配置了 legacy 时

kickstart

字符串

用于启动系统的软件版本

返回: 当配置了 legacy 时

module

字典

关于远程设备中模块的事实的哈希值

返回: 当配置了 legacy 时

platform

字符串

远程设备报告的硬件平台

返回: 当配置了 legacy 时

power_supply_info

字符串

关于远程设备中电源的事实的哈希值

返回: 当配置了 legacy 时

vlan_list

列表 / 元素=字符串

远程设备上配置的 VLAN ID 列表

返回: 当配置了 legacy 时

作者

  • Jason Edelman (@jedelman8)

  • Gabriele Gerbino (@GGabriele)