community.ciscosmb.facts 模块 – 从运行 Cisco SMB 的远程设备收集事实

注意

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

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

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

要在 playbook 中使用它,请指定: community.ciscosmb.facts

概要

  • 从运行 Cisco SMB 的远程设备收集一组基本设备事实。此模块将所有基本网络事实键名前缀为 ansible_net_<fact>。事实模块将始终从设备收集一组基本事实,并可以启用或禁用其他事实的收集。

参数

参数

注释

gather_subset

列表 / 元素=字符串

提供此参数时,它将收集的事实限制为给定的子集。此参数的可能值为 allhardwareconfiginterfaces。可以指定一个值列表以包含更大的子集。值也可以与初始 ! 一起使用,以指定不应收集特定子集。

选项

  • "default"

  • "all"

  • "hardware"

  • "config"

  • "interfaces"

  • "!hardware"

  • "!config" ← (默认)

  • "!interfaces"

默认值: ["!config"]

备注

注意

  • 支持 check_mode

示例

- name: Collect all facts from the device
  community.ciscosmb.facts:
    gather_subset: all

- name: Collect only the config and default facts
  community.ciscosmb.facts:
    gather_subset:
      - config

- name: Do not collect hardware facts
  community.ciscosmb.facts:
    gather_subset:
      - "!hardware"

返回值

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

描述

ansible_net_all_ipv4_addresses

列表 / 元素=字符串

设备上配置的所有 IPv4 地址。

返回:当配置 interfaces 时

ansible_net_all_ipv6_addresses

列表 / 元素=字符串

设备上配置的所有 IPv6 地址。

返回:当配置 interfaces 时

ansible_net_config

字符串

设备的当前活动配置。

返回:当配置 config 时

ansible_net_cpu_load

字符串

当前 CPU 负载。

返回:始终返回

ansible_net_gather_subset

列表 / 元素=字符串

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

返回:始终返回

ansible_net_hostname

字符串

设备的配置主机名。

返回:始终返回

ansible_net_interfaces

字典

系统上运行的所有接口的哈希表。

返回:当配置 interfaces 时

ansible_net_memfree_mb

整数

远程设备上可用的空闲内存(以 MiB 为单位)。

返回:当配置 hardware 时

ansible_net_memtotal_mb

整数

远程设备上的总内存(以 MiB 为单位)。

返回:当配置 hardware 时

ansible_net_model

字符串

设备返回的型号名称。

返回:始终返回

ansible_net_neighbors

字典

远程设备的邻居列表。

返回:当配置 interfaces 时

ansible_net_serialnum

字符串

远程设备的序列号。

返回:始终返回

ansible_net_spacefree_mb

字典

远程设备上可用的磁盘空间(以 MiB 为单位)。

返回:当配置 hardware 时

ansible_net_spacetotal_mb

字典

远程设备上的总磁盘空间(以 MiB 为单位)。

返回:当配置 hardware 时

ansible_net_stacked_models

列表 / 元素=字符串

堆栈中每个设备的型号名称。

返回:当在堆栈中配置多个设备时

ansible_net_stacked_serialnums

列表 / 元素=字符串

堆栈中每个设备的序列号。

返回:当在堆栈中配置多个设备时

ansible_net_uptime

字符串

设备的运行时间。

返回:始终返回

ansible_net_version

字符串

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

返回:始终返回

作者

  • Petr Klima (@qaxi)