amnesh.soodar.soodar_interfaces module – Manages interface attributes of Amnesh Soodar network devices
Note
This module is part of the amnesh.soodar collection (version 1.0.0).
To install it, use: ansible-galaxy collection install https://soodar.ir/ansible/amnesh.soodar.tar.gz
.
To use it in a playbook, specify: amnesh.soodar.soodar_interfaces
.
New in amnesh.soodar 1.0
Synopsis
This module manages the interface attributes of Amnesh Soodar network devices.
Note
This module has a corresponding action plugin.
Parameters
Parameter |
Comments |
---|---|
A dictionary of interface options |
|
Interface description. |
|
Administrative state of the interface. Set the value to Choices:
|
|
MTU for a specific interface. Must be a number between 64 and 9600. Applicable for Ethernet interfaces only. |
|
Full name of interface, e.g. ge0, tunnel20. |
|
This option is used only with state parsed. The value of this option should be the output received from the Soodar device by executing the command show running-config | section ^interface. The state parsed reads the configuration from |
|
The state the configuration should be left in The states rendered, gathered and parsed does not perform any change on the device. The state rendered will transform the configuration in The state gathered will fetch the running configuration from device and transform it into structured data in the format as per the resource module argspec and the value is returned in the gathered key within the result. The state parsed reads the configuration from Choices:
|
Notes
Note
Tested against Soodar Version 21.04
Examples
# Using Deleted
# Before state:
# -------------
#
# soodar# show running-config | section ^interface
# interface ge1
# no ip address
# interface ge2
# description Configured and Overridden by Ansible Network
# no ip address
# interface ge3
# description Configured and Replaced by Ansible Network
# mtu 2500
# no ip address
# shutdown
- name: Delete attributes of given interfaces (Note: This won't delete the interface itself)
soodar_interfaces:
config:
- name: ge2
- name: ge3
operation: deleted
# After state:
# -------------
#
# soodar# show running-config | section ^interface
# interface ge1
# no ip address
# interface ge2
# no ip address
# interface ge3
# no ip address
# Using merged
# Before state:
# -------------
#
# soodar#show running-config | section ^interface
# interface ge1
# description Configured by Ansible
# no ip address
# interface ge2
# description This is test
# no ip address
# interface ge3
# no ip address
- name: Merge provided configuration with device configuration
soodar_interfaces:
config:
- name: ge2
description: 'Configured and Merged by Ansible Network'
enabled: True
- name: ge3
description: 'Configured and Merged by Ansible Network'
mtu: 2800
enabled: False
operation: merged
# After state:
# ------------
#
# soodar#show running-config | section ^interface
# interface ge1
# description Configured by Ansible
# no ip address
# interface ge2
# description Configured and Merged by Ansible Network
# no ip address
# no shutdown
# interface ge3
# description Configured and Merged by Ansible Network
# mtu 2800
# no ip address
# shutdown
# Using overridden
# Before state:
# -------------
#
# soodar#show running-config | section ^interface#
# interface ge1
# description Configured by Ansible
# no ip address
# interface ge2
# description This is test
# no ip address
# interface ge3
# description Configured by Ansible
# mtu 2800
# no ip address
# shutdown
- name: Override device configuration of all interfaces with provided configuration
soodar_interfaces:
config:
- name: ge2
description: 'Configured and Overridden by Ansible Network'
mtu: 3000
- name: ge3
description: 'Configured and Overridden by Ansible Network'
enabled: False
mtu: 2000
operation: overridden
# After state:
# -------------
#
# soodar#show running-config | section ^interface
# interface ge1
# no ip address
# interface ge2
# description Configured and Overridden by Ansible Network
# no ip address
# mtu 3000
# interface ge3
# description Configured and Overridden by Ansible Network
# mtu 2000
# no ip address
# shutdown
# Using replaced
# Before state:
# -------------
#
# soodar#show running-config | section ^interface
# interface ge1
# no ip address
# interface ge2
# description Configured by Ansible Network
# no ip address
# interface ge3
# mtu 2000
# no ip address
# shutdown
- name: Replaces device configuration of listed interfaces with provided configuration
soodar_interfaces:
config:
- name: ge3
description: 'Configured and Replaced by Ansible Network'
enabled: False
mtu: 2500
operation: replaced
# After state:
# -------------
#
# soodar#show running-config | section ^interface
# interface ge1
# no ip address
# interface ge2
# description Configured by Ansible Network
# no ip address
# interface ge3
# description Configured and Replaced by Ansible Network
# mtu 2500
# no ip address
# shutdown
# Using Gathered
# Before state:
# -------------
#
# soodar# sh running-config | section ^interface
# interface ge1
# no shutdown
# description this is interface1
# mtu 65
# interface ge2
# description this is interface2
# mtu 110
# shutdown
- name: Gather listed interfaces with provided configurations
amnesh.soodar.soodar_interfaces:
config:
state: gathered
# Module Execution Result:
# ------------------------
#
# "gathered": [
# {
# "description": "this is interface1",
# "enabled": true,
# "mtu": 65,
# "name": "ge1",
# },
# {
# "description": "this is interface2",
# "duplex": "auto",
# "enabled": false,
# "mtu": 110,
# }
# ]
# After state:
# ------------
#
# soodar# sh running-config | section ^interface
# interface ge1
# no shutdown
# description this is interface1
# mtu 65
# interface ge2
# description this is interface2
# mtu 110
# shutdown
# Using Rendered
- name: Render the commands for provided configuration
amnesh.soodar.soodar_interfaces:
config:
- name: ge1
description: Configured by Ansible-Network
mtu: 110
enabled: true
- name: ge2
description: Configured by Ansible-Network
mtu: 2800
enabled: false
state: rendered
# Module Execution Result:
# ------------------------
#
# "rendered": [
# "interface ge1",
# "description Configured by Ansible-Network",
# "mtu 110",
# "no shutdown",
# "interface ge2",
# "description Configured by Ansible-Network",
# "mtu 2800",
# "shutdown"
# Using Parsed
# File: parsed.cfg
# ----------------
#
# interface ge1
# description interfaces 0/1
# mtu 110
# no shutdown
# interface ge2
# description interfaces 0/2
# mtu 2800
# shutdown
- name: Parse the commands for provided configuration
amnesh.soodar.soodar_interfaces:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Module Execution Result:
# ------------------------
#
# "parsed": [
# {
# "description": "interfaces 0/1",
# "enabled": true,
# "mtu": 110,
# "name": "ge1"
# },
# {
# "description": "interfaces 0/2",
# "enabled": true,
# "mtu": 2800,
# "name": "ge2",
# }
# ]
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The configuration as structured data after module completion. Returned: when changed Sample: |
|
The configuration as structured data prior to module invocation. Returned: always Sample: |
|
The set of commands pushed to the remote device Returned: always Sample: |