community.general.oneview_network_set_info 模块 – 获取关于 OneView 网络集的信息

注意

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

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

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

要在 playbook 中使用它,请指定:community.general.oneview_network_set_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

列表 / 元素=字符串

用于收集有关网络集信息的选项列表。允许的选项:withoutEthernetwithoutEthernet 选项检索不包含以太网网络的 network_sets 列表。

params

字典

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

允许的参数键为

start: 返回的第一项,使用从 0 开始的索引。

count: 返回的资源数量。

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

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

password

字符串

用于 API 身份验证的密码。

username

字符串

用于 API 身份验证的用户名。

属性

属性

支持

描述

check_mode

支持:完整

在 community.general 3.3.0 中添加

此操作不会修改状态。

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

diff_mode

支持: N/A

此操作不会修改状态。

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

注意

注意

示例

- name: Gather information about all Network Sets
  community.general.oneview_network_set_info:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
  no_log: true
  delegate_to: localhost
  register: result

- name: Print fetched information about Network Sets
  ansible.builtin.debug:
    msg: "{{ result.network_sets }}"

- name: Gather paginated, filtered and sorted information about Network Sets
  community.general.oneview_network_set_info:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
    params:
      start: 0
      count: 3
      sort: 'name:descending'
      filter: name='netset001'
  no_log: true
  delegate_to: localhost
  register: result

- name: Print fetched information about paginated, filtered and sorted list of Network Sets
  ansible.builtin.debug:
    msg: "{{ result.network_sets }}"

- name: Gather information about all Network Sets, excluding Ethernet networks
  community.general.oneview_network_set_info:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
    options:
        - withoutEthernet
  no_log: true
  delegate_to: localhost
  register: result

- name: Print fetched information about Network Sets, excluding Ethernet networks
  ansible.builtin.debug:
    msg: "{{ result.network_sets }}"

- name: Gather information about a Network Set by name
  community.general.oneview_network_set_info:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
    name: Name of the Network Set
  no_log: true
  delegate_to: localhost
  register: result

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

- name: Gather information about a Network Set by name, excluding Ethernet networks
  community.general.oneview_network_set_info:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 500
    name: Name of the Network Set
    options:
        - withoutEthernet
  no_log: true
  delegate_to: localhost
  register: result

- name: Print fetched information about Network Set found by name, excluding Ethernet networks
  ansible.builtin.debug:
    msg: "{{ result.network_sets }}"

返回值

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

描述

network_sets

字典

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

返回:始终返回,但可以为空。

作者

  • Felipe Bulsoni (@fgbulsoni)

  • Thiago Miotto (@tmiotto)

  • Adriane Cardozo (@adriane-cardozo)