amnesh.soodar.soodar_ospf_interfaces module – Resource module to configure OSPF interfaces.
Note
This module is part of the amnesh.soodar collection (version 2.0.0).
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
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_ospf_interfaces.
Synopsis
Manages and configures Open Shortest Path First (OSPF) version 2 and it’s attributes over interface on Soodar platforms.
Parameters
Parameter |
Comments |
|---|---|
A dictionary of OSPF interfaces options. |
|
OSPF interfaces settings on the interfaces in address-family context. |
|
Address Family Identifier (AFI) for OSPF interfaces settings on the interfaces. Choices:
|
|
Enable authentication |
|
Use a key-chain for cryptographic authentication keys |
|
Use message-digest authentication Choices:
|
|
Use no authentication Choices:
|
|
BFD configuration commands Enable/Disable BFD on this interface Choices:
|
|
Interface cost |
|
Interface cost or Route cost of this interface |
|
Interval after which a neighbor is declared dead |
|
Set to 1 second and set multiplier for Hellos Number of Hellos sent within 1 second. Please refer vendor documentation of Valid values. Valid only with IP OSPF config |
|
time in seconds |
|
Time between HELLO packets Please refer vendor documentation of Valid values. |
|
Ignores the MTU in DBD packets Choices:
|
|
Network type |
|
Specify OSPF broadcast multi-access network Choices:
|
|
Specify OSPF NBMA network Choices:
|
|
Specify OSPF point-to-multipoint network Choices:
|
|
Specify OSPF point-to-point network Choices:
|
|
Router priority. Please refer vendor documentation of Valid values. |
|
OSPF interfaces process config |
|
OSPF interfaces area ID as a decimal value. Please refer vendor documentation of Valid values. OSPF interfaces area ID in IP address format(e.g. A.B.C.D) |
|
Address Family Identifier (AFI) for OSPF interfaces settings on the interfaces. Please refer vendor documentation of Valid values. |
|
Time between retransmitting lost link state advertisements. Please refer vendor documentation of Valid values. |
|
Link state transmit delay. Please refer vendor documentation of Valid values. |
|
Full name of the interface i.e. ge0. |
|
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 sh 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 23.11
This module works with connection
amnesh.soodar.network_cli.
Examples
# Using deleted
# Before state:
# -------------
#
# soodar# sh running-config | section ^interface
# interface ge0
# interface ge1
# ipv6 ospf priority 20
# ipv6 ospf area 105
# ipv6 ospf transmit-delay 30
# interface ge2
# ip ospf priority 40
# ip ospf 10 area 20
# ip ospf cost 30
- name: Delete provided OSPF Interface config
amnesh.soodar.soodar_ospf_interfaces:
config:
- name: ge1
state: deleted
# Task Output:
# ------------
# before:
# - name: ge0
# - address_family:
# afi: ipv6
# priority: 20
# process:
# area_id: '105'
# transmit_delay: 30
# name: ge1
# - address_family:
# - adjacency: true
# afi: ipv4
# cost:
# interface_cost: 30
# priority: 40
# process:
# id: 10
# area_id: '20'
# name: ge2
#
# commands:
# - interface ge1
# - no ipv6 ospf area 105
# - no ipv6 ospf priority 20
# - no ipv6 ospf transmit-delay 30
#
# after:
# - name: ge0
# - name: ge1
# - address_family:
# - adjacency: true
# afi: ipv4
# cost:
# interface_cost: 30
# priority: 40
# process:
# area_id: '20'
# id: 10
# name: ge2
#
# After state:
# -------------
# soodar# sh running-config | section ^interface
# interface ge0
# interface ge1
# interface ge2
# ip ospf priority 40
# ip ospf 10 area 20
# ip ospf cost 30
# Using deleted without any config passed (NOTE: This will delete all OSPF Interfaces configuration from device)
# Before state:
# -------------
#
# soodar# sh running-config | section ^interface
# interface ge0
# interface ge1
# ipv6 ospf 55 area 105
# ipv6 ospf priority 20
# ipv6 ospf transmit-delay 30
# interface ge2
# ip ospf priority 40
# ip ospf 10 area 20
# ip ospf cost 30
- name: Delete all OSPF config from interfaces
amnesh.soodar.soodar_ospf_interfaces:
state: deleted
# Task Output:
# ------------
# before:
# - name: ge0
# - address_family:
# afi: ipv6
# priority: 20
# process:
# area_id: '105'
# id: 55
# transmit_delay: 30
# name: ge1
# - address_family:
# afi: ipv4
# cost:
# interface_cost: 30
# priority: 40
# process:
# area_id: '20'
# id: 10
# name: ge2
#
# commands:
# - interface ge2
# - no ip ospf 10 area 20
# - no ip ospf cost 30
# - no ip ospf priority 40
# - interface ge1
# - no ipv6 ospf 55 area 105
# - no ipv6 ospf priority 20
# - no ipv6 ospf transmit-delay 30
#
# after:
# - name: ge0
# - name: ge1
# - name: ge2
# After state:
# -------------
# soodar# sh running-config | section ^interface
# interface ge0
# interface ge1
# interface ge2
# Using merged
# Before state:
# -------------
#
# soodar# sh running-config | section ^interface
# soodar#
- name: Merge provided OSPF Interfaces configuration
amnesh.soodar.soodar_ospf_interfaces:
config:
- name: ge1
address_family:
- afi: ipv4
process:
id: 10
area_id: 30
bfd: true
cost:
interface_cost: 5
dead_interval:
time: 5
network:
broadcast: true
priority: 25
- afi: ipv6
priority: 55
transmit_delay: 45
state: merged
# Task Output:
# ------------
# before: []
#
# commands:
# - interface ge1
# - ip ospf 10 area 30
# - ip ospf bfd
# - ip ospf cost 5
# - ip ospf dead-interval 5
# - ip ospf network broadcast
# - ip ospf priority 25
# - ipv6 ospf priority 55
# - ipv6 ospf transmit-delay 45
#
# after:
# - name: ge0
# - address_family:
# afi: ipv4
# bfd: true
# cost:
# interface_cost: 5
# dead_interval:
# time: 5
# network:
# broadcast: true
# priority: 25
# process:
# area_id: '30'
# id: 10
# afi: ipv6
# priority: 55
# transmit_delay: 45
# name: ge1
# - name: ge2
# After state:
# -------------
#
# soodar# sh running-config | section ^interface
# interface ge0
# interface ge1
# ip ospf network broadcast
# ip ospf dead-interval 5
# ip ospf priority 25
# ip ospf bfd
# ip ospf 10 area 30
# ip ospf cost 5
# ipv6 ospf priority 55
# ipv6 ospf transmit-delay 45
# interface ge2
# Using replaced
# Before state:
# -------------
#
# soodar# sh running-config | section ^interface
# interface ge0
# interface ge1
# ip ospf network broadcast
# ip ospf dead-interval 5
# ip ospf priority 25
# ip ospf bfd
# ip ospf 10 area 30
# ip ospf cost 5
# ipv6 ospf priority 55
# ipv6 ospf transmit-delay 45
# interface ge2
- name: Replaced provided OSPF Interfaces configuration
amnesh.soodar.soodar_ospf_interfaces:
config:
- name: ge2
address_family:
- afi: ipv6
priority: 20
transmit_delay: 30
state: replaced
# Task Output:
# ------------
#
# before:
# - name: ge0
# - address_family:
# afi: ipv4
# bfd: true
# cost:
# interface_cost: 5
# dead_interval:
# time: 5
# network:
# broadcast: true
# priority: 25
# process:
# area_id: '30'
# id: 10
# afi: ipv6
# priority: 55
# process:
# area_id: '45'
# id: 35
# transmit_delay: 45
# name: ge1
# - name: ge2
#
# commands:
# - interface ge2
# - ipv6 ospf 55 area 105
# - ipv6 ospf priority 20
# - ipv6 ospf transmit-delay 30
#
# after:
# - name: ge0
# - address_family:
# afi: ipv4
# bfd: true
# cost:
# interface_cost: 5
# dead_interval:
# time: 5
# network:
# broadcast: true
# priority: 25
# process:
# area_id: '30'
# id: 10
# afi: ipv6
# priority: 55
# process:
# area_id: '45'
# id: 35
# transmit_delay: 45
# name: ge1
# - address_family:
# afi: ipv6
# priority: 20
# process:
# area_id: '105'
# id: 55
# transmit_delay: 30
# name: ge2
# After state:
# -------------
# soodar# sh running-config | section ^interface
# interface ge0
# interface ge1
# ip ospf network broadcast
# ip ospf dead-interval 5
# ip ospf priority 25
# ip ospf bfd
# ip ospf 10 area 30
# ip ospf cost 5
# ipv6 ospf priority 55
# ipv6 ospf transmit-delay 45
# interface ge2
# ipv6 ospf priority 20
# ipv6 ospf transmit-delay 30
# Using overridden
# Before state:
# -------------
#
# soodar# sh running-config | section ^interface
# interface ge0
# interface ge1
# ip ospf network broadcast
# ip ospf dead-interval 5
# ip ospf priority 25
# ip ospf bfd
# ip ospf 10 area 30
# ip ospf cost 5
# ipv6 ospf priority 55
# ipv6 ospf transmit-delay 45
# interface ge2
- name: Override running config with provided OSPF Interfaces configuration
amnesh.soodar.soodar_ospf_interfaces:
config:
- name: ge1
address_family:
- afi: ipv6
priority: 20
transmit_delay: 30
- name: ge2
address_family:
- afi: ipv4
process:
id: 10
area_id: 20
cost:
interface_cost: 30
priority: 40
state: overridden
# Task Output:
# ------------
#
# before:
# - name: ge0
# - address_family:
# afi: ipv4
# bfd: true
# cost:
# interface_cost: 5
# dead_interval:
# time: 5
# network:
# broadcast: true
# priority: 25
# process:
# area_id: '30'
# id: 10
# afi: ipv6
# priority: 55
# process:
# area_id: '45'
# id: 35
# transmit_delay: 45
# name: ge1
# - name: ge2
#
# commands:
# - interface ge2
# - ip ospf 10 area 20
# - ip ospf cost 30
# - ip ospf priority 40
# - interface ge1
# - ipv6 ospf 55 area 105
# - ipv6 ospf priority 20
# - ipv6 ospf transmit-delay 30
# - no ip ospf 10 area 30
# - no ip ospf bfd
# - no ip ospf cost 5
# - no ip ospf dead-interval 5
# - no ip ospf network broadcast
# - no ip ospf priority 25
#
# parsed:
# - name: ge0
# - address_family:
# afi: ipv6
# priority: 20
# process:
# area_id: '105'
# id: 55
# transmit_delay: 30
# name: ge1
# - address_family:
# afi: ipv4
# cost:
# interface_cost: 30
# priority: 40
# process:
# area_id: '20'
# id: 10
# name: ge2
# After state:
# -------------
#
# soodar# sh running-config | section ^interface
# interface ge0
# interface ge1
# ipv6 ospf 55 area 105
# ipv6 ospf priority 20
# ipv6 ospf transmit-delay 30
# interface ge2
# ip ospf priority 40
# ip ospf 10 area 20
# ip ospf cost 30
# Using Gathered
# Before state:
# -------------
#
# soodar# sh running-config | section ^interface
# interface ge0
# interface ge1
# ip ospf network broadcast
# ip ospf dead-interval 5
# ip ospf priority 25
# ip ospf bfd
# ip ospf 10 area 30
# ip ospf cost 5
# ipv6 ospf priority 55
# ipv6 ospf transmit-delay 45
# interface ge2
- name: Gather OSPF Interfaces provided configurations
amnesh.soodar.soodar_ospf_interfaces:
config:
state: gathered
# Task Output:
# ------------
#
# gathered:
# - name: ge0
# - address_family:
# afi: ipv4
# bfd: true
# cost:
# interface_cost: 5
# dead_interval:
# time: 5
# network:
# broadcast: true
# priority: 25
# process:
# area_id: '30'
# id: 10
# afi: ipv6
# priority: 55
# process:
# area_id: '45'
# id: 35
# transmit_delay: 45
# name: ge1
# - name: ge2
# After state:
# ------------
#
# soodar# sh running-config | section ^interface
# interface ge0
# interface ge1
# ip ospf network broadcast
# ip ospf dead-interval 5
# ip ospf priority 25
# ip ospf bfd
# ip ospf 10 area 30
# ip ospf cost 5
# ipv6 ospf priority 55
# ipv6 ospf transmit-delay 45
# interface ge2
# Using Rendered
- name: Render the commands for provided configuration
amnesh.soodar.soodar_ospf_interfaces:
config:
- name: ge1
address_family:
- afi: ipv4
process:
id: 10
area_id: 30
adjacency: true
bfd: true
cost:
interface_cost: 5
dead_interval:
time: 5
network:
broadcast: true
priority: 25
resync_timeout: 10
- afi: ipv6
adjacency: true
priority: 55
transmit_delay: 45
state: rendered
# Task Output:
# ------------
#
# rendered:
# - interface GigabitEthernet0/1
# - ip ospf 10 area 30
# - ip ospf bfd
# - ip ospf cost 5
# - ip ospf dead-interval 5
# - ip ospf network broadcast
# - ip ospf priority 25
# - ipv6 ospf 35 area 45
# - ipv6 ospf priority 55
# - ipv6 ospf transmit-delay 45
# Using Parsed
# File: parsed.cfg
# ----------------
#
# interface ge2
# interface ge1
# ip ospf network broadcast
# ip ospf dead-interval 5
# ip ospf priority 25
# ip ospf bfd
# ip ospf 10 area 30
# ip ospf cost 5
# ipv6 ospf 35 area 45
# ipv6 ospf priority 55
# ipv6 ospf transmit-delay 45
# interface ge0
- name: Parse the provided configuration with the existing running configuration
amnesh.soodar.soodar_ospf_interfaces:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Task Output:
# ------------
#
# parsed:
# - name: ge2
# - address_family:
# afi: ipv4
# bfd: true
# cost:
# interface_cost: 5
# dead_interval:
# time: 5
# network:
# broadcast: true
# priority: 25
# process:
# area_id: '30'
# id: 10
# afi: ipv6
# priority: 55
# process:
# area_id: '45'
# id: 35
# transmit_delay: 45
# name: ge1
# - name: ge0
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The resulting configuration after module execution. Returned: when changed Sample: |
|
The configuration prior to the module execution. Returned: when state is Sample: |
|
The set of commands pushed to the remote device. Returned: when state is Sample: |
|
Facts about the network resource gathered from the remote device as structured data. Returned: when state is Sample: |
|
The device native config provided in running_config option parsed into structured data as per module argspec. Returned: when state is Sample: |
|
The provided configuration in the task rendered in device-native format (offline). Returned: when state is Sample: |