community.general.oneview_ethernet_network 模块 – 管理 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

概要

  • 提供管理以太网网络资源的接口。可以创建、更新或删除。

要求

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

  • Python >= 2.7.9

  • hpOneView >= 3.1.0

参数

参数

注释

api_version

整数

OneView API 版本。

config

路径

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

data

字典 / 必需

包含以太网网络属性的列表。

hostname

字符串

设备的 IP 地址或主机名。

image_streamer_hostname

字符串

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

password

字符串

API 身份验证的密码。

state

字符串

指示以太网网络资源的所需状态。- present 将确保数据属性符合 OneView。- absent 将从 OneView 中删除资源(如果存在)。- default_bandwidth_reset 将网络连接模板重置为默认值。

选项

  • "present" ← (默认)

  • "absent"

  • "default_bandwidth_reset"

username

字符串

API 身份验证的用户名。

validate_etag

布尔值

启用 ETag 验证时,只有在资源的当前 ETag 与数据中提供的 ETag 匹配时,请求才会被有条件地处理。

选项

  • false

  • true ← (默认)

属性

属性

支持

描述

check_mode

支持:不支持

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

diff_mode

支持:不支持

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

备注

注意

示例

- name: Ensure that the Ethernet Network is present using the default configuration
  community.general.oneview_ethernet_network:
    config: '/etc/oneview/oneview_config.json'
    state: present
    data:
      name: 'Test Ethernet Network'
      vlanId: '201'
  delegate_to: localhost

- name: Update the Ethernet Network changing bandwidth and purpose
  community.general.oneview_ethernet_network:
    config: '/etc/oneview/oneview_config.json'
    state: present
    data:
      name: 'Test Ethernet Network'
      purpose: Management
      bandwidth:
          maximumBandwidth: 3000
          typicalBandwidth: 2000
  delegate_to: localhost

- name: Ensure that the Ethernet Network is present with name 'Renamed Ethernet Network'
  community.general.oneview_ethernet_network:
    config: '/etc/oneview/oneview_config.json'
    state: present
    data:
      name: 'Test Ethernet Network'
      newName: 'Renamed Ethernet Network'
  delegate_to: localhost

- name: Ensure that the Ethernet Network is absent
  community.general.oneview_ethernet_network:
    config: '/etc/oneview/oneview_config.json'
    state: absent
    data:
      name: 'New Ethernet Network'
  delegate_to: localhost

- name: Create Ethernet networks in bulk
  community.general.oneview_ethernet_network:
    config: '/etc/oneview/oneview_config.json'
    state: present
    data:
      vlanIdRange: '1-10,15,17'
      purpose: General
      namePrefix: TestNetwork
      smartLink: false
      privateNetwork: false
      bandwidth:
        maximumBandwidth: 10000
        typicalBandwidth: 2000
  delegate_to: localhost

- name: Reset to the default network connection template
  community.general.oneview_ethernet_network:
    config: '/etc/oneview/oneview_config.json'
    state: default_bandwidth_reset
    data:
      name: 'Test Ethernet Network'
  delegate_to: localhost

返回值

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

描述

ethernet_network

字典

包含有关以太网网络的事实。

返回:在状态“present”下。可以为空。

ethernet_network_bulk

字典

包含有关受批量插入影响的以太网网络的事实。

返回:当 data 参数中包含 'vlanIdRange' 属性时。可以为空。

ethernet_network_connection_template

字典

包含有关以太网网络连接模板的事实。

返回:在状态“default_bandwidth_reset”下。可以为空。

作者

  • Felipe Bulsoni (@fgbulsoni)

  • Thiago Miotto (@tmiotto)

  • Adriane Cardozo (@adriane-cardozo)