community / community.network / 5.0.2 / module / ce_switchport Manages Layer 2 switchport interfaces on HUAWEI CloudEngine switches. Authors: QijunPan (@QijunPan)community.network.ce_switchport (5.0.2) — module
Install with ansible-galaxy collection install community.network:==5.0.2
collections: - name: community.network version: 5.0.2
Manages Layer 2 switchport interfaces on HUAWEI CloudEngine switches.
- 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
mode: choices: - access - trunk - hybrid - dot1qtunnel description: - The link type of an interface. state: choices: - present - absent - unconfigured default: present description: - Manage the state of the resource. interface: description: - Full name of the interface, i.e. 40GE1/0/22. required: true pvid_vlan: description: - If C(mode=trunk, or mode=hybrid), used as the trunk native VLAN ID, in the range from 1 to 4094. trunk_vlans: description: - If C(mode=trunk), used as the VLAN range to ADD or REMOVE from the trunk, such as 2-10 or 2,5,10-15, etc. default_vlan: description: - If C(mode=access, or mode=dot1qtunnel), used as the access VLAN ID, in the range from 1 to 4094. tagged_vlans: description: - If C(mode=hybrid), used as the VLAN range to ADD or REMOVE from the trunk, such as 2-10 or 2,5,10-15, etc. untagged_vlans: description: - If C(mode=hybrid), used as the VLAN range to ADD or REMOVE from the trunk, such as 2-10 or 2,5,10-15, etc.
changed: description: check to see if a change was made on the device returned: always sample: true type: bool end_state: description: k/v pairs of switchport after module execution returned: always sample: default_vlan: '20' interface: 10GE1/0/22 mode: access switchport: enable type: dict existing: description: k/v pairs of existing switchport returned: always sample: default_vlan: '10' interface: 10GE1/0/22 mode: access switchport: enable type: dict proposed: description: k/v pairs of parameters passed into module returned: always sample: default_vlan: '20' interface: 10GE1/0/22 mode: access type: dict updates: description: command string sent to the device returned: always sample: - 10GE1/0/22 - port default vlan 20 type: list