community.general.ce_ip_interface (0.1.1) — module

Manages L3 attributes for IPv4 and IPv6 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 Layer 3 attributes for IPv4 and IPv6 interfaces on HUAWEI CloudEngine switches.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: ip_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 ipv4 address is configured on 10GE1/0/22
    ce_ip_interface:
      interface: 10GE1/0/22
      version: v4
      state: present
      addr: 20.20.20.20
      mask: 24
      provider: '{{ cli }}'

  - name: Ensure ipv4 secondary address is configured on 10GE1/0/22
    ce_ip_interface:
      interface: 10GE1/0/22
      version: v4
      state: present
      addr: 30.30.30.30
      mask: 24
      ipv4_type: sub
      provider: '{{ cli }}'

  - name: Ensure ipv6 is enabled on 10GE1/0/22
    ce_ip_interface:
      interface: 10GE1/0/22
      version: v6
      state: present
      provider: '{{ cli }}'

  - name: Ensure ipv6 address is configured on 10GE1/0/22
    ce_ip_interface:
      interface: 10GE1/0/22
      version: v6
      state: present
      addr: 2001::db8:800:200c:cccb
      mask: 64
      provider: '{{ cli }}'

Inputs

    
addr:
    description:
    - IPv4 or IPv6 Address.

mask:
    description:
    - Subnet mask for IPv4 or IPv6 Address in decimal format.

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

version:
    choices:
    - v4
    - v6
    default: v4
    description:
    - IP address version.

interface:
    description:
    - Full name of interface, i.e. 40GE1/0/22, vlanif10.
    required: true

ipv4_type:
    choices:
    - main
    - sub
    default: main
    description:
    - Specifies an address type. The value is an enumerated type. main, primary IP address.
      sub, secondary IP address.

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 IP attributes after module execution
  returned: always
  sample:
    interface: 10GE1/0/22
    ipv4:
    - addrType: main
      ifIpAddr: 20.20.20.20
      subnetMask: 255.255.255.0
  type: dict
existing:
  description: k/v pairs of existing IP attributes on the interface
  returned: always
  sample:
    interface: 10GE1/0/22
    ipv4:
    - addrType: main
      ifIpAddr: 11.11.11.11
      subnetMask: 255.255.0.0
  type: dict
proposed:
  description: k/v pairs of parameters passed into module
  returned: always
  sample:
    addr: 20.20.20.20
    interface: 10GE1/0/22
    mask: '24'
  type: dict
updates:
  description: commands sent to the device
  returned: always
  sample:
  - interface 10GE1/0/22
  - ip address 20.20.20.20 24
  type: list