community.general.ce_interface (0.1.1) — module

Manages physical attributes of interfaces on HUAWEI CloudEngine switches.

Authors: QijunPan (@QijunPan)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

Manages physical attributes of interfaces on HUAWEI CloudEngine switches.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: interface module test
  hosts: cloudengine
  connection: local
  gather_facts: no
  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
    ce_interface:
      interface: 10GE1/0/22
      description: 'Configured by Ansible'
      mode: layer3
      provider: '{{ cli }}'

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

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

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

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

Inputs

    
mode:
    choices:
    - layer2
    - layer3
    description:
    - Manage Layer 2 or Layer 3 state of the interface.

l2sub:
    default: 'no'
    description:
    - Specifies whether the interface is a Layer 2 sub-interface.
    type: bool

state:
    choices:
    - present
    - absent
    - default
    default: present
    description:
    - Specify desired state of the resource.

interface:
    description:
    - Full name of interface, i.e. 40GE1/0/10, Tunnel1.

admin_state:
    choices:
    - up
    - down
    description:
    - Specifies the interface management status. The value is an enumerated type. up,
      An interface is in the administrative Up state. down, An interface is in the administrative
      Down state.

description:
    description:
    - Specifies an interface description. The value is a string of 1 to 242 case-sensitive
      characters, spaces supported but question marks (?) not supported.

interface_type:
    choices:
    - ge
    - 10ge
    - 25ge
    - 4x10ge
    - 40ge
    - 100ge
    - vlanif
    - loopback
    - meth
    - eth-trunk
    - nve
    - tunnel
    - ethernet
    - fcoe-port
    - fabric-port
    - stack-port
    - 'null'
    description:
    - Interface type to be configured from the device.

Outputs

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:
    admin_state: down
    description: None
    interface: 10GE1/0/10
    mode: layer2
  type: dict
existing:
  description: k/v pairs of existing switchport
  returned: always
  sample:
    admin_state: up
    description: None
    interface: 10GE1/0/10
    mode: layer2
  type: dict
proposed:
  description: k/v pairs of parameters passed into module
  returned: always
  sample:
    admin_state: down
    interface: 10GE1/0/10
  type: dict
updates:
  description: command list sent to the device
  returned: always
  sample:
  - interface 10GE1/0/10
  - shutdown
  type: list