community.network.ce_interface 模块 – 管理华为CloudEngine交换机接口的物理属性。

注意

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

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

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

要在playbook中使用它,请指定: community.network.ce_interface

注意

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

已弃用

在以下版本中移除:

6.0.0版本

原因:

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

替代方案:

未知。

概要

  • 管理华为CloudEngine交换机上的接口物理属性。

别名:network.cloudengine.ce_interface

参数

参数

注释

admin_state

字符串

指定接口管理状态。值为枚举类型。up,接口处于管理Up状态。down,接口处于管理Down状态。

选项

  • "up"

  • "down"

description

字符串

指定接口描述。值为1到242个区分大小写的字符的字符串,支持空格,但不支持问号(?)。

interface

字符串

接口的全名,例如40GE1/0/10、Tunnel1。

interface_type

字符串

要从设备配置的接口类型。

选项

  • "ge"

  • "10ge"

  • "25ge"

  • "4x10ge"

  • "40ge"

  • "100ge"

  • "vlanif"

  • "loopback"

  • "meth"

  • "eth-trunk"

  • "nve"

  • "tunnel"

  • "ethernet"

  • "fcoe-port"

  • "fabric-port"

  • "stack-port"

  • "null"

l2sub

布尔值

指定接口是否为二层子接口。

选项

  • false ← (默认)

  • true

mode

字符串

管理接口的二层或三层状态。

选项

  • "layer2"

  • "layer3"

state

字符串

指定资源的所需状态。

选项

  • "present" ← (默认)

  • "absent"

  • "default"

备注

注意

  • 此模块还用于创建逻辑接口,例如vlanif和loopback。

  • 此模块要求在被管理的远程设备上启用netconf系统服务。

  • 推荐的连接方式是 netconf

  • 此模块也适用于旧版playbook的 local 连接。

示例

- name: Interface module test
  hosts: cloudengine
  connection: local
  gather_facts: false
  vars:
    cli:
      host: "{{ inventory_hostname }}"
      port: "{{ ansible_ssh_port }}"
      username: "{{ username }}"
      password: "{{ password }}"
      transport: cli

  tasks:
  - name: Ensure an interface is a Layer 3 port and that it has the proper description
    community.network.ce_interface:
      interface: 10GE1/0/22
      description: 'Configured by Ansible'
      mode: layer3
      provider: '{{ cli }}'

  - name: Admin down an interface
    community.network.ce_interface:
      interface: 10GE1/0/22
      admin_state: down
      provider: '{{ cli }}'

  - name: Remove all tunnel interfaces
    community.network.ce_interface:
      interface_type: tunnel
      state: absent
      provider: '{{ cli }}'

  - name: Remove all logical interfaces
    community.network.ce_interface:
      interface_type: '{{ item }}'
      state: absent
      provider: '{{ cli }}'
    with_items:
      - loopback
      - eth-trunk
      - nve

  - name: Admin up all 10GE interfaces
    community.network.ce_interface:
      interface_type: 10GE
      admin_state: up
      provider: '{{ cli }}'

返回值

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

描述

changed

布尔值

检查设备上是否进行了更改

返回值:始终

示例: true

end_state

字典

模块执行后交换机的k/v对

返回值:始终

示例: {"admin_state": "down", "description": "None", "interface": "10GE1/0/10", "mode": "layer2"}

existing

字典

现有交换机的k/v对

返回值:始终

示例: {"admin_state": "up", "description": "None", "interface": "10GE1/0/10", "mode": "layer2"}

proposed

字典

传递到模块的参数的k/v对

返回值:始终

示例: {"admin_state": "down", "interface": "10GE1/0/10"}

更新

列表 / 元素=字符串

发送到设备的命令列表

返回值:始终

示例: ["interface 10GE1/0/10", "shutdown"]

状态

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

  • 更多信息请参见 已弃用

作者

  • 潘启俊 (@QijunPan)