vyos.vyos.vyos_ospf_interfaces module – OSPF Interfaces Resource Module.
Note
This module is part of the vyos.vyos collection (version 6.0.0).
You might already have this collection installed if you are using the ansible package.
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 vyos.vyos.
To use it in a playbook, specify: vyos.vyos.vyos_ospf_interfaces.
New in vyos.vyos 1.2.0
Synopsis
This module manages OSPF configuration of interfaces on devices running VYOS.
The provided examples of commands are valid for VyOS 1.4+
Parameters
Parameter |
Comments |
|---|---|
A list of OSPF configuration for interfaces. |
|
OSPF settings on the interfaces in address-family context. |
|
Address Family Identifier (AFI) for OSPF settings on the interfaces. Choices:
|
|
Authentication settings on the interface. |
|
md5 parameters. |
|
md5 key. |
|
key id. |
|
Plain Text password. |
|
Bandwidth of interface (kilobits/sec) |
|
metric associated with interface. |
|
Time interval to detect a dead router. |
|
Timer interval between transmission of hello packets. |
|
interface MTU. |
|
Instance ID. |
|
if True, Disable MTU check for Database Description packets. Choices:
|
|
Interface type. |
|
If True, disables forming adjacency. Choices:
|
|
Interface priority. |
|
LSA retransmission interval. |
|
LSA transmission delay. |
|
Name/Identifier of the interface. |
|
This option is used only with state parsed. The value of this option should be the output received from the VYOS device by executing the command show configuration commands | match “set interfaces”. The state parsed reads the configuration from |
|
The state the configuration should be left in. Choices:
|
Examples
# Using merged
#
# Before state:
# -------------
#
# @vyos:~$ show configuration commands | match "ospf"
- name: Merge provided configuration with device configuration
vyos.vyos.vyos_ospf_interfaces:
config:
- name: "eth1"
address_family:
- afi: "ipv4"
transmit_delay: 50
priority: 26
network: "point-to-point"
- afi: "ipv6"
dead_interval: 39
- name: "bond2"
address_family:
- afi: "ipv4"
transmit_delay: 45
bandwidth: 70
authentication:
md5_key:
key_id: 10
key: "1111111111232345"
- afi: "ipv6"
passive: true
state: merged
# After State:
# --------------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set protocols ospf interface bond2 authentication md5 key-id 10 md5-key '1111111111232345'
# set protocols ospf interface bond2 bandwidth '70'
# set protocols ospf interface bond2 transmit-delay '45'
# set protocols ospfv3 interface bond2 'passive'
# set protocols ospf interface eth1 network 'point-to-point'
# set protocols ospf interface eth1 priority '26'
# set protocols ospf interface eth1 transmit-delay '50'
# set protocols ospfv3 interface eth1 dead-interval '39'
# "after": [
# "
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "before": [
# {
# "name": "eth0"
# },
# {
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "changed": true,
# "commands": [
# "set protocols ospf interface eth1 transmit-delay 50",
# "set protocols ospf interface eth1 priority 26",
# "set protocols ospf interface eth1 network point-to-point",
# "set protocols ospfv3 interface eth1 dead-interval 39",
# "set protocols ospf interface bond2 transmit-delay 45",
# "set protocols ospf interface bond2 bandwidth 70",
# "set protocols ospf interface bond2 authentication md5 key-id 10 md5-key 1111111111232345",
# "set protocols ospfv3 interface bond2 passive"
# ],
# Using replaced:
# Before State:
# ------------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set protocols ospf interface bond2 authentication md5 key-id 10 md5-key '1111111111232345'
# set protocols ospf interface bond2 bandwidth '70'
# set protocols ospf interface bond2 transmit-delay '45'
# set protocols ospfv3 interface bond2 'passive'
# set protocols ospf interface eth1 network 'point-to-point'
# set protocols ospf interface eth1 priority '26'
# set protocols ospf interface eth1 transmit-delay '50'
# set protocols ospfv3 interface eth1 dead-interval '39'
- name: Replace provided configuration with device configuration
vyos.vyos.vyos_ospf_interfaces:
config:
- name: "eth1"
address_family:
- afi: "ipv4"
cost: 100
- afi: "ipv6"
ifmtu: 33
- name: "bond2"
address_family:
- afi: "ipv4"
transmit_delay: 45
- afi: "ipv6"
passive: true
state: replaced
# After State:
# -----------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set protocols ospf interface bond2 transmit-delay '45'
# set protocols ospfv3 interface bond2 'passive'
# set protocols ospf interface eth1 cost '100'
# set protocols ospfv3 interface eth1 ifmtu '33'
# vyos@vyos:~$
# Module Execution
# ----------------
# "after": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "cost": 100
# },
# {
# "afi": "ipv6",
# "ifmtu": 33
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "before": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "changed": true,
# "commands": [
# "set protocols ospf interface eth1 cost 100",
# "set protocols ospfv3 interface eth1 ifmtu 33",
# "delete protocols ospf interface eth1 network point-to-point",
# "delete protocols ospf interface eth1 priority 26",
# "delete protocols ospf interface eth1 transmit-delay 50",
# "delete protocols ospfv3 interface eth1 dead-interval 39",
# "delete protocols ospf interface bond2 authentication",
# "delete protocols ospf interface bond2 bandwidth 70"
# ],
#
# Using Overridden:
# -----------------
# Before State:
# ------------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set protocols ospf interface bond2 authentication md5 key-id 10 md5-key '1111111111232345'
# set protocols ospf interface bond2 bandwidth '70'
# set protocols ospf interface bond2 transmit-delay '45'
# set protocols ospfv3 interface bond2 'passive'
# set protocols ospf interface eth1 cost '100'
# set protocols ospf interface eth1 network 'point-to-point'
# set protocols ospf interface eth1 priority '26'
# set protocols ospf interface eth1 transmit-delay '50'
# set protocols ospfv3 interface eth1 dead-interval '39'
# set protocols ospfv3 interface eth1 ifmtu '33'
# vyos@vyos:~$
- name: Override device configuration with provided configuration
vyos.vyos.vyos_ospf_interfaces:
config:
- name: "eth0"
address_family:
- afi: "ipv4"
cost: 100
- afi: "ipv6"
ifmtu: 33
passive: true
state: overridden
# After State:
# -----------
# 200~vyos@vyos:~$ show configuration commands | match "ospf"
# set protocols ospf interface eth0 cost '100'
# set protocols ospfv3 interface eth0 ifmtu '33'
# set protocols ospfv3 interface eth0 'passive'
# vyos@vyos:~$
#
#
# "after": [
# {
# "name": "bond2"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "cost": 100
# },
# {
# "afi": "ipv6",
# "ifmtu": 33,
# "passive": true
# }
# ],
# "name": "eth0"
# },
# {
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "before": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "cost": 100,
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39,
# "ifmtu": 33
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "changed": true,
# "commands": [
# "delete protocols ospf interface bond2",
# "delete protocols ospfv3 interface bond2",
# "delete protocols ospf interface eth1",
# "delete protocols ospfv3 interface eth1",
# "set protocols ospf interface eth0 cost 100",
# "set protocols ospfv3 interface eth0 ifmtu 33",
# "set protocols ospfv3 interface eth0 passive"
# ],
#
# Using deleted:
# -------------
# before state:
# -------------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set protocols ospf interface bond2 authentication md5 key-id 10 md5-key '1111111111232345'
# set protocols ospf interface bond2 bandwidth '70'
# set protocols ospf interface bond2 transmit-delay '45'
# set protocols ospfv3 interface bond2 'passive'
# set protocols ospf interface eth0 cost '100'
# set protocols ospfv3 interface eth0 ifmtu '33'
# set protocols ospfv3 interface eth0 'passive'
# set protocols ospf interface eth1 network 'point-to-point'
# set protocols ospf interface eth1 priority '26'
# set protocols ospf interface eth1 transmit-delay '50'
# set protocols ospfv3 interface eth1 dead-interval '39'
# vyos@vyos:~$
- name: Delete device configuration
vyos.vyos.vyos_ospf_interfaces:
config:
- name: "eth0"
state: deleted
# After State:
# -----------
# vyos@vyos:~$ show configuration commands | match "ospf"
# set protocols ospf interface bond2 authentication md5 key-id 10 md5-key '1111111111232345'
# set protocols ospf interface bond2 bandwidth '70'
# set protocols ospf interface bond2 transmit-delay '45'
# set protocols ospfv3 interface bond2 'passive'
# set protocols ospf interface eth1 network 'point-to-point'
# set protocols ospf interface eth1 priority '26'
# set protocols ospf interface eth1 transmit-delay '50'
# set protocols ospfv3 interface eth1 dead-interval '39'
# vyos@vyos:~$
#
#
# "after": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "before": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "cost": 100
# },
# {
# "afi": "ipv6",
# "ifmtu": 33,
# "passive": true
# }
# ],
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
# "changed": true,
# "commands": [
# "delete protocols ospf interface eth0",
# "delete protocols ospfv3 interface eth0"
# ],
#
# Using parsed:
# parsed.cfg:
# set protocols ospf interface bond2 authentication md5 key-id 10 md5-key '1111111111232345'
# set protocols ospf interface bond2 bandwidth '70'
# set protocols ospf interface bond2 transmit-delay '45'
# set protocols ospfv3 interface bond2 'passive'
# set protocols ospf interface eth0 cost '50'
# set protocols ospf interface eth0 priority '26'
# set protocols ospfv3 interface eth0 instance-id '33'
# set protocols ospfv3 interface eth0 'mtu-ignore'
# set protocols ospf interface eth1 network 'point-to-point'
# set protocols ospf interface eth1 priority '26'
# set protocols ospf interface eth1 transmit-delay '50'
# set protocols ospfv3 interface eth1 dead-interval '39'
#
- name: parse configs
vyos.vyos.vyos_ospf_interfaces:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
# Module Execution:
# ----------------
# "parsed": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "cost": 50,
# "priority": 26
# },
# {
# "afi": "ipv6",
# "instance": "33",
# "mtu_ignore": true
# }
# ],
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# }
# ]
# Using rendered:
# --------------
- name: Render
vyos.vyos.vyos_ospf_interfaces:
config:
- name: "eth1"
address_family:
- afi: "ipv4"
transmit_delay: 50
priority: 26
network: "point-to-point"
- afi: "ipv6"
dead_interval: 39
- name: "bond2"
address_family:
- afi: "ipv4"
transmit_delay: 45
bandwidth: 70
authentication:
md5_key:
key_id: 10
key: "1111111111232345"
- afi: "ipv6"
passive: true
state: rendered
# Module Execution:
# ----------------
# "rendered": [
# "set protocols ospf interface eth1 transmit-delay 50",
# "set protocols ospf interface eth1 priority 26",
# "set protocols ospf interface eth1 network point-to-point",
# "set protocols ospfv3 interface eth1 dead-interval 39",
# "set protocols ospf interface bond2 transmit-delay 45",
# "set protocols ospf interface bond2 bandwidth 70",
# "set protocols ospf interface bond2 authentication md5 key-id 10 md5-key 1111111111232345",
# "set protocols ospfv3 interface bond2 passive"
# ]
#
# Using Gathered:
# --------------
# Native Config:
# vyos@vyos:~$ show configuration commands | match "ospf"
# set protocols ospf interface bond2 authentication md5 key-id 10 md5-key '1111111111232345'
# set protocols ospf interface bond2 bandwidth '70'
# set protocols ospf interface bond2 transmit-delay '45'
# set protocols ospfv3 interface bond2 'passive'
# set protocols ospf interface eth1 network 'point-to-point'
# set protocols ospf interface eth1 priority '26'
# set protocols ospf interface eth1 transmit-delay '50'
# set protocols ospfv3 interface eth1 dead-interval '39'
# vyos@vyos:~$
- name: gather configs
vyos.vyos.vyos_ospf_interfaces:
state: gathered
# Module Execution:
# -----------------
# "gathered": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "md5_key": {
# "key": "1111111111232345",
# "key_id": 10
# }
# },
# "bandwidth": 70,
# "transmit_delay": 45
# },
# {
# "afi": "ipv6",
# "passive": true
# }
# ],
# "name": "bond2"
# },
# {
# "name": "eth0"
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "network": "point-to-point",
# "priority": 26,
# "transmit_delay": 50
# },
# {
# "afi": "ipv6",
# "dead_interval": 39
# }
# ],
# "name": "eth1"
# },
# {
# "name": "eth2"
# },
# {
# "name": "eth3"
# }
# ],
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: |