community.general.oneview_ethernet_network_info 模块 – 获取一个或多个 OneView 以太网网络信息

注意

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

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

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

要在 playbook 中使用它,请指定: community.general.oneview_ethernet_network_info

概要

  • 从 OneView 获取一个或多个以太网网络的信息。

要求

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

  • Python >= 2.7.9

  • hpOneView >= 2.0.1

参数

参数

注释

api_version

整数

OneView API 版本。

config

路径

包含 OneView 客户端配置的 JSON 配置文件的路径。配置文件是可选的,当使用时应存在于运行 ansible 命令的主机中。如果未提供文件路径,则配置将从环境变量加载。有关示例配置文件的链接或如何使用环境变量,请验证备注部分。

hostname

字符串

设备的 IP 地址或主机名。

image_streamer_hostname

字符串

HPE Image Streamer REST API 的 IP 地址或主机名。

name

字符串

以太网网络名称。

options

列表 / 元素=字符串

包含选项的列表,用于收集有关以太网网络和相关资源的附加信息。允许的选项:associatedProfilesassociatedUplinkGroups

params

字典

用于限定、过滤和排序资源列表的参数列表。

允许的参数键为

start:返回的第一个项目,使用基于 0 的索引。

count:要返回的资源数量。

filter:用于缩小返回的项目列表的通用过滤器/查询字符串。

sort:返回数据集的排序顺序。

password

字符串

API 身份验证密码。

username

字符串

API 身份验证用户名。

属性

属性

支持

描述

check_mode

支持:完全支持

在 community.general 3.3.0 中添加

此操作不会修改状态。

可以在 check_mode 中运行,并在不修改目标的情况下返回更改状态预测。

diff_mode

支持: N/A

此操作不会修改状态。

处于 diff 模式时,将返回有关已更改内容(或可能需要在 check_mode 中更改的内容)的详细信息。

备注

注意

示例

- name: Gather information about all Ethernet Networks
  community.general.oneview_ethernet_network_info:
    config: /etc/oneview/oneview_config.json
  delegate_to: localhost
  register: result

- name: Print fetched information about Ethernet Networks
  ansible.builtin.debug:
    msg: "{{ result.ethernet_networks }}"

- name: Gather paginated and filtered information about Ethernet Networks
  community.general.oneview_ethernet_network_info:
    config: /etc/oneview/oneview_config.json
    params:
      start: 1
      count: 3
      sort: 'name:descending'
      filter: 'purpose=General'
  delegate_to: localhost
  register: result

- name: Print fetched information about paginated and filtered list of Ethernet Networks
  ansible.builtin.debug:
    msg: "{{ result.ethernet_networks }}"

- name: Gather information about an Ethernet Network by name
  community.general.oneview_ethernet_network_info:
    config: /etc/oneview/oneview_config.json
    name: Ethernet network name
  delegate_to: localhost
  register: result

- name: Print fetched information about Ethernet Network found by name
  ansible.builtin.debug:
    msg: "{{ result.ethernet_networks }}"

- name: Gather information about an Ethernet Network by name with options
  community.general.oneview_ethernet_network_info:
    config: /etc/oneview/oneview_config.json
    name: eth1
    options:
      - associatedProfiles
      - associatedUplinkGroups
  delegate_to: localhost
  register: result

- name: Print fetched information about Ethernet Network Associated Profiles
  ansible.builtin.debug:
    msg: "{{ result.enet_associated_profiles }}"

- name: Print fetched information about Ethernet Network Associated Uplink Groups
  ansible.builtin.debug:
    msg: "{{ result.enet_associated_uplink_groups }}"

返回值

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

描述

enet_associated_profiles

字典

包含有关正在使用以太网网络的配置文件的所有 OneView 信息。

返回值: 请求时返回,但可能是空值。

字典

包含有关正在使用以太网网络的上行链路集的所有 OneView 信息。

返回值: 请求时返回,但可能是空值。

ethernet_networks

字典

包含有关以太网网络的所有 OneView 信息。

返回值: 始终返回,但可能是空值。

作者

  • Felipe Bulsoni (@fgbulsoni)

  • Thiago Miotto (@tmiotto)

  • Adriane Cardozo (@adriane-cardozo)