community.network.ce_switchport 模块 – 管理华为 CloudEngine 交换机上的二层交换端口接口。
注意
此模块是 community.network 集合 (版本 5.1.0) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install community.network
。
要在 playbook 中使用它,请指定: community.network.ce_switchport
。
注意
community.network 集合已被弃用,并将从 Ansible 12 中删除。有关更多信息,请参见 讨论主题。
已弃用
- 在以下版本中移除:
6.0.0 版本
- 原因:
此集合及其中的所有内容均未维护且已弃用。
- 替代方案:
未知。
概要
管理华为 CloudEngine 交换机上的二层交换端口接口。
别名:network.cloudengine.ce_switchport
参数
参数 |
注释 |
---|---|
如果 |
|
接口的全名,例如 40GE1/0/22。 |
|
接口的链路类型。 选项
|
|
如果 |
|
管理资源的状态。 选项
|
|
如果 |
|
如果 |
|
如果 |
备注
注意
当
state=absent
时,可以将 VLAN 添加到或从 trunk 链路中移除,并且可以将现有的访问 VLAN “取消配置”为仅在该接口上具有 VLAN 1。在使用 trunk VLAN 时,关键字 add/remove 始终发送到
port trunk allow-pass vlan
命令中。使用详细模式查看发送的命令。当
state=unconfigured
时,该接口将具有默认的二层接口,即访问模式下的 vlan 1。此模块要求在被管理的远程设备上启用 netconf 系统服务。
推荐连接为
ansible.netcommon.netconf
。
示例
- name: Switchport module test
hosts: cloudengine
gather_facts: false
vars:
ansible_user: root
ansible_password: PASSWORD
ansible_connection: ansible.netcommon.netconf
ansible_network_os: community.network.ce
tasks:
- name: Ensure 10GE1/0/22 is in its default switchport state
community.network.ce_switchport:
interface: 10GE1/0/22
state: unconfigured
- name: Ensure 10GE1/0/22 is configured for access vlan 20
community.network.ce_switchport:
interface: 10GE1/0/22
mode: access
default_vlan: 20
- name: Ensure 10GE1/0/22 only has vlans 5-10 as trunk vlans
community.network.ce_switchport:
interface: 10GE1/0/22
mode: trunk
pvid_vlan: 10
trunk_vlans: 5-10
- name: Ensure 10GE1/0/22 is a trunk port and ensure 2-50 are being tagged (doesn't mean others aren't also being tagged)
community.network.ce_switchport:
interface: 10GE1/0/22
mode: trunk
pvid_vlan: 10
trunk_vlans: 2-50
- name: Ensure these VLANs are not being tagged on the trunk
community.network.ce_switchport:
interface: 10GE1/0/22
mode: trunk
trunk_vlans: 51-4000
state: absent
返回值
常见的返回值已记录在 此处,以下是此模块独有的字段
键 |
描述 |
---|---|
检查设备上是否进行了更改 返回: 始终 示例: |
|
模块执行后交换机的键值对 返回: 始终 示例: |
|
现有交换端口的键值对 返回: 始终 示例: |
|
传递到模块的参数的键值对 返回: 始终 示例: |
|
发送到设备的命令字符串 返回: 始终 示例: |
状态
此模块将在6.0.0版本中移除。 [已弃用]
更多信息请参见 已弃用。