community.network.cnos_interface 模块 – 管理 Lenovo CNOS 网络设备上的接口

注意

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

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

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

要在剧本中使用它,请指定: community.network.cnos_interface

注意

community.network 集合已弃用,并将从 Ansible 12 中移除。有关更多信息,请参阅 讨论主题

已弃用

在以下版本中移除:

6.0.0 版本

原因:

此集合及其中的所有内容均未维护且已弃用。

替代方案:

未知。

概要

  • 此模块提供对 Lenovo CNOS 网络设备上接口的声明式管理。

别名:network.cnos.cnos_interface

参数

参数

注释

aggregate

字符串

接口定义列表。

delay

字符串

在检查远程设备上的运行状态之前等待的时间(以秒为单位)。此等待适用于运行状态参数,这些参数是值为 up/down 的 *state*、*tx_rate* 和 *rx_rate*。

默认值: 20

description

字符串

接口描述。

duplex

字符串

接口链路状态

选项

  • "full"

  • "half"

  • "auto" ← (默认)

enabled

布尔值

接口链路状态。

选项

  • false

  • true ← (默认)

mtu

字符串

最大传输数据包大小。

name

字符串 / 必需

接口名称。

neighbors

字符串

检查给定接口 name 的 LLDP 邻居的运行状态。

可以使用以下子选项。

host

字符串

给定接口 name 的 LLDP 邻居主机。

port

字符串

接口 name 连接到的 LLDP 邻居端口。

rx_rate

字符串

接收速率(每秒比特数 (bps))。

这仅是状态检查参数。

支持条件语句,请参阅 网络模块中的条件语句

speed

字符串

接口链路速度。

state

字符串

接口配置的状态,up 表示存在且正在运行,down 表示存在且已停止运行。

选项

  • "present" ← (默认)

  • "absent"

  • "up"

  • "down"

tx_rate

字符串

传输速率(每秒比特数 (bps))。

这仅是状态检查参数。

支持条件语句,请参阅 网络模块中的条件语句

备注

注意

  • 已针对 CNOS 10.8.1 进行测试

示例

- name: Configure interface
  community.network.cnos_interface:
      name: Ethernet1/33
      description: test-interface
      speed: 100
      duplex: half
      mtu: 999

- name: Remove interface
  community.network.cnos_interface:
    name: loopback3
    state: absent

- name: Make interface up
  community.network.cnos_interface:
    name: Ethernet1/33
    enabled: true

- name: Make interface down
  community.network.cnos_interface:
    name: Ethernet1/33
    enabled: false

- name: Check intent arguments
  community.network.cnos_interface:
    name: Ethernet1/33
    state: up
    tx_rate: ge(0)
    rx_rate: le(0)

- name: Check neighbors intent arguments
  community.network.cnos_interface:
    name: Ethernet1/33
    neighbors:
    - port: eth0
      host: netdev

- name: Config + intent
  community.network.cnos_interface:
    name: Ethernet1/33
    enabled: false
    state: down

- name: Add interface using aggregate
  community.network.cnos_interface:
    aggregate:
    - { name: Ethernet1/33, mtu: 256, description: test-interface-1 }
    - { name: Ethernet1/44, mtu: 516, description: test-interface-2 }
    duplex: full
    speed: 100
    state: present

- name: Delete interface using aggregate
  community.network.cnos_interface:
    aggregate:
    - name: loopback3
    - name: loopback6
    state: absent

返回值

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

描述

commands

列表 / 元素=字符串

发送到设备的配置模式命令列表。

返回值: 始终返回,但使用 Netconf 传输来管理设备的平台除外。

示例: ["interface Ethernet1/33", "description test-interface", "duplex half", "mtu 512"]

状态

  • 此模块将在 6.0.0 版本中移除。[已弃用]

  • 更多信息请参见 已弃用

作者

  • Anil Kumar Muraleedharan(@amuraleedhar)