community.general.ce_static_route (0.1.1) — module

Manages static route configuration on HUAWEI CloudEngine switches.

Authors: Yang yang (@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 the static routes on HUAWEI CloudEngine switches.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: static route 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: Config a ipv4 static route, next hop is an address and that it has the proper description
    ce_static_route:
      prefix: 2.1.1.2
      mask: 24
      next_hop: 3.1.1.2
      description: 'Configured by Ansible'
      aftype: v4
      provider: "{{ cli }}"
  - name: Config a ipv4 static route ,next hop is an interface and that it has the proper description
    ce_static_route:
      prefix: 2.1.1.2
      mask: 24
      next_hop: 10GE1/0/1
      description: 'Configured by Ansible'
      aftype: v4
      provider: "{{ cli }}"
  - name: Config a ipv6 static route, next hop is an address and that it has the proper description
    ce_static_route:
      prefix: fc00:0:0:2001::1
      mask: 64
      next_hop: fc00:0:0:2004::1
      description: 'Configured by Ansible'
      aftype: v6
      provider: "{{ cli }}"
  - name: Config a ipv4 static route, next hop is an interface and that it has the proper description
    ce_static_route:
      prefix: fc00:0:0:2001::1
      mask: 64
      next_hop: 10GE1/0/1
      description: 'Configured by Ansible'
      aftype: v6
      provider: "{{ cli }}"
  - name: Config a VRF and set ipv4 static route, next hop is an address and that it has the proper description
    ce_static_route:
      vrf: vpna
      prefix: 2.1.1.2
      mask: 24
      next_hop: 3.1.1.2
      description: 'Configured by Ansible'
      aftype: v4
      provider: "{{ cli }}"

Inputs

    
tag:
    description:
    - Route tag value (numeric).

vrf:
    description:
    - VPN instance of destination ip address.

mask:
    description:
    - Destination ip mask of static route.
    required: true

pref:
    description:
    - Preference or administrative difference of route (range 1-255).

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

aftype:
    choices:
    - v4
    - v6
    description:
    - Destination ip address family type of static route.
    required: true

prefix:
    description:
    - Destination ip address of static route.
    required: true

destvrf:
    description:
    - VPN instance of next hop ip address.

next_hop:
    description:
    - Next hop address of static route.

description:
    description:
    - Name of the route. Used with the name parameter on the CLI.

nhp_interface:
    description:
    - Next hop interface full name of static route.

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:
    description: testing
    mask: '24'
    next_hop: 3.3.3.3
    pref: '100'
    prefix: 192.168.20.0
    tag: 'null'
  type: dict
existing:
  description: k/v pairs of existing switchport
  returned: always
  sample: {}
  type: dict
proposed:
  description: k/v pairs of parameters passed into module
  returned: always
  sample:
    description: testing
    mask: '24'
    next_hop: 3.3.3.3
    pref: '100'
    prefix: 192.168.20.642
    vrf: _public_
  type: dict
updates:
  description: command list sent to the device
  returned: always
  sample:
  - ip route-static 192.168.20.0 255.255.255.0 3.3.3.3 preference 100 description
    testing
  type: list