vyos.vyos.vyos_ospfv2 module – OSPFv2 resource module
Note
This module is part of the vyos.vyos collection (version 5.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_ospfv2
.
New in vyos.vyos 1.0.0
Synopsis
This resource module configures and manages attributes of OSPFv2 routes on VyOS network devices.
Aliases: ospfv2
Parameters
Parameter |
Comments |
---|---|
A provided OSPFv2 route configuration. |
|
OSPFv2 area. |
|
OSPFv2 area identity. |
|
Area type. |
|
Normal OSPFv2 area. Choices:
|
|
NSSA OSPFv2 area. |
|
Summary-default cost of NSSA area. |
|
Do not inject inter-area routes into stub. Choices:
|
|
Enabling NSSA. Choices:
|
|
NSSA-ABR. Choices:
|
|
Stub OSPFv2 area. |
|
Summary-default cost of stub area. |
|
Do not inject inter-area routes into stub. Choices:
|
|
Enabling stub. Choices:
|
|
OSPFv2 area authentication type. Choices:
|
|
OSPFv2 network. |
|
OSPFv2 IPv4 network address. |
|
Summarize routes matching prefix (border routers only). |
|
border router IPv4 address. |
|
Metric for this range. |
|
Don’t advertise this range. Choices:
|
|
Announce area range (IPv4 address) as another prefix. |
|
Area’s shortcut mode. Choices:
|
|
Virtual link address. |
|
virtual link address. |
|
OSPFv2 area authentication type. |
|
MD5 key id based authentication. |
|
MD5 key id. |
|
MD5 key. |
|
Plain text password. |
|
Interval after which a neighbor is declared dead. |
|
Interval between hello packets. |
|
Interval between retransmitting lost link state advertisements. |
|
Link state transmit delay. |
|
Calculate OSPFv2 interface cost according to bandwidth. |
|
Reference bandwidth cost in Mbits/sec. |
|
Control distribution of default information. |
|
Distribute a default route. |
|
Always advertise default route. Choices:
|
|
OSPFv2 default metric. |
|
OSPFv2 Metric types for default routes. |
|
Route map references. |
|
Metric of redistributed routes |
|
Administrative distance. |
|
Global OSPFv2 administrative distance. |
|
OSPFv2 administrative distance. |
|
Distance for external routes. |
|
Distance for inter-area routes. |
|
Distance for intra-area routes. |
|
Log changes in adjacency state. Choices:
|
|
OSPFv2 maximum/infinite-distance metric. |
|
Advertise own Router-LSA with infinite distance (stub router). |
|
Administratively apply, for an indefinite period. Choices:
|
|
Time to advertise self as stub-router. |
|
Time to advertise self as stub-router |
|
MultiProtocol Label Switching-Traffic Engineering (MPLS-TE) parameters. |
|
Enable MPLS-TE functionality. Choices:
|
|
Stable IP address of the advertising router. |
|
Neighbor IP address. |
|
Identity (number/IP address) of neighbor. |
|
Seconds between dead neighbor polling interval. |
|
Neighbor priority. |
|
OSPFv2 specific parameters. |
|
OSPFv2 ABR Type. Choices:
|
|
Enable the Opaque-LSA capability (rfc2370). Choices:
|
|
Enable rfc1583 criteria for handling AS external routes. Choices:
|
|
Override the default router identifier. |
|
Suppress routing updates on an interface. |
|
Interface to exclude when using passive-interface default. |
|
Redistribute information from another routing protocol. |
|
Metric for redistribution routes. |
|
OSPFv2 Metric types. |
|
Route map references. |
|
Route type to redistribute. Choices:
|
|
Filter routes installed in local route map. |
|
Adjust routing timers. |
|
Adjust refresh parameters. |
|
refresh timer. |
|
Throttling adaptive timers. |
|
OSPFv2 SPF timers. |
|
Delay (msec) from first change received till SPF calculation. |
|
Initial hold time(msec) between consecutive SPF calculations. |
|
maximum hold time (sec). |
|
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 | grep ospf. The state parsed reads the configuration from |
|
The state the configuration should be left in. Choices:
|
Notes
Note
Tested against VyOS 1.1.8 (helium).
This module works with connection
ansible.netcommon.network_cli
. See the VyOS OS Platform Options.
Examples
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos# run show configuration commands | grep ospf
#
#
- name: Merge the provided configuration with the existing running configuration
vyos.vyos.vyos_ospfv2:
config:
log_adjacency_changes: detail
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
metric_type: 2
route_map: ingress
mpls_te:
enabled: true
router_address: 192.0.11.11
auto_cost:
reference_bandwidth: 2
neighbor:
- neighbor_id: 192.0.11.12
poll_interval: 10
priority: 2
redistribute:
- route_type: bgp
metric: 10
metric_type: 2
passive_interface:
- eth1
- eth2
parameters:
router_id: 192.0.1.1
opaque_lsa: true
rfc1583_compatibility: true
abr_type: cisco
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '3'
area_type:
nssa:
set: true
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
range:
- address: 192.0.3.0/24
cost: 10
- address: 192.0.4.0/24
cost: 12
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# before": {}
#
# "commands": [
# "set protocols ospf mpls-te enable",
# "set protocols ospf mpls-te router-address '192.0.11.11'",
# "set protocols ospf redistribute bgp",
# "set protocols ospf redistribute bgp metric-type 2",
# "set protocols ospf redistribute bgp metric 10",
# "set protocols ospf default-information originate metric-type 2",
# "set protocols ospf default-information originate always",
# "set protocols ospf default-information originate metric 10",
# "set protocols ospf default-information originate route-map ingress",
# "set protocols ospf auto-cost reference-bandwidth '2'",
# "set protocols ospf parameters router-id '192.0.1.1'",
# "set protocols ospf parameters opaque-lsa",
# "set protocols ospf parameters abr-type 'cisco'",
# "set protocols ospf parameters rfc1583-compatibility",
# "set protocols ospf passive-interface eth1",
# "set protocols ospf passive-interface eth2",
# "set protocols ospf max-metric router-lsa on-shutdown 10",
# "set protocols ospf max-metric router-lsa administrative",
# "set protocols ospf max-metric router-lsa on-startup 10",
# "set protocols ospf log-adjacency-changes 'detail'",
# "set protocols ospf neighbor 192.0.11.12 priority 2",
# "set protocols ospf neighbor 192.0.11.12 poll-interval 10",
# "set protocols ospf neighbor 192.0.11.12",
# "set protocols ospf area '2'",
# "set protocols ospf area 2 authentication plaintext-password",
# "set protocols ospf area 2 shortcut enable",
# "set protocols ospf area 2 area-type normal",
# "set protocols ospf area '3'",
# "set protocols ospf area 3 area-type nssa",
# "set protocols ospf area 4 range 192.0.3.0/24 cost 10",
# "set protocols ospf area 4 range 192.0.3.0/24",
# "set protocols ospf area 4 range 192.0.4.0/24 cost 12",
# "set protocols ospf area 4 range 192.0.4.0/24",
# "set protocols ospf area 4 area-type stub default-cost 20",
# "set protocols ospf area '4'",
# "set protocols ospf area 4 network 192.0.2.0/24"
# ]
#
# "after": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos# run show configuration commands | grep ospf
#
#
- name: Merge the provided configuration to update existing running configuration
vyos.vyos.vyos_ospfv2:
config:
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '3'
area_type:
nssa:
set: false
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
- address: 192.0.22.0/24
- address: 192.0.32.0/24
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# "commands": [
# "delete protocols ospf area 4 area-type stub",
# "set protocols ospf area 4 network 192.0.22.0/24"
# "set protocols ospf area 4 network 192.0.32.0/24"
# ]
#
# "after": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# },
# {
# "address": "192.0.22.0/24"
# },
# {
# "address": "192.0.32.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 network '192.0.22.0/24'
# set protocols ospf area 4 network '192.0.32.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using replaced
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
#
- name: Replace ospfv2 routes attributes configuration.
vyos.vyos.vyos_ospfv2:
config:
log_adjacency_changes: detail
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
metric_type: 2
route_map: ingress
mpls_te:
enabled: true
router_address: 192.0.22.22
auto_cost:
reference_bandwidth: 2
neighbor:
- neighbor_id: 192.0.11.12
poll_interval: 10
priority: 2
redistribute:
- route_type: bgp
metric: 10
metric_type: 2
passive_interface:
- eth1
parameters:
router_id: 192.0.1.1
opaque_lsa: true
rfc1583_compatibility: true
abr_type: cisco
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
- address: 192.0.12.0/24
- address: 192.0.22.0/24
- address: 192.0.32.0/24
range:
- address: 192.0.42.0/24
cost: 10
state: replaced
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# "commands": [
# "delete protocols ospf passive-interface eth2",
# "delete protocols ospf area 3",
# "delete protocols ospf area 4 range 192.0.3.0/24 cost",
# "delete protocols ospf area 4 range 192.0.3.0/24",
# "delete protocols ospf area 4 range 192.0.4.0/24 cost",
# "delete protocols ospf area 4 range 192.0.4.0/24",
# "set protocols ospf mpls-te router-address '192.0.22.22'",
# "set protocols ospf area 4 range 192.0.42.0/24 cost 10",
# "set protocols ospf area 4 range 192.0.42.0/24",
# "set protocols ospf area 4 network 192.0.12.0/24",
# "set protocols ospf area 4 network 192.0.22.0/24",
# "set protocols ospf area 4 network 192.0.32.0/24"
# ]
#
# "after": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.12.0/24"
# },
# {
# "address": "192.0.2.0/24"
# },
# {
# "address": "192.0.22.0/24"
# },
# {
# "address": "192.0.32.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.42.0/24",
# "cost": 10
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.22.22"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 network '192.0.12.0/24'
# set protocols ospf area 4 network '192.0.22.0/24'
# set protocols ospf area 4 network '192.0.32.0/24'
# set protocols ospf area 4 range 192.0.42.0/24 cost '10'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.22.22'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_ospfv2:
config:
log_adjacency_changes: detail
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
metric_type: 2
route_map: ingress
mpls_te:
enabled: true
router_address: 192.0.11.11
auto_cost:
reference_bandwidth: 2
neighbor:
- neighbor_id: 192.0.11.12
poll_interval: 10
priority: 2
redistribute:
- route_type: bgp
metric: 10
metric_type: 2
passive_interface:
- eth1
- eth2
parameters:
router_id: 192.0.1.1
opaque_lsa: true
rfc1583_compatibility: true
abr_type: cisco
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '3'
area_type:
nssa:
set: true
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
range:
- address: 192.0.3.0/24
cost: 10
- address: 192.0.4.0/24
cost: 12
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# [
# "set protocols ospf mpls-te enable",
# "set protocols ospf mpls-te router-address '192.0.11.11'",
# "set protocols ospf redistribute bgp",
# "set protocols ospf redistribute bgp metric-type 2",
# "set protocols ospf redistribute bgp metric 10",
# "set protocols ospf default-information originate metric-type 2",
# "set protocols ospf default-information originate always",
# "set protocols ospf default-information originate metric 10",
# "set protocols ospf default-information originate route-map ingress",
# "set protocols ospf auto-cost reference-bandwidth '2'",
# "set protocols ospf parameters router-id '192.0.1.1'",
# "set protocols ospf parameters opaque-lsa",
# "set protocols ospf parameters abr-type 'cisco'",
# "set protocols ospf parameters rfc1583-compatibility",
# "set protocols ospf passive-interface eth1",
# "set protocols ospf passive-interface eth2",
# "set protocols ospf max-metric router-lsa on-shutdown 10",
# "set protocols ospf max-metric router-lsa administrative",
# "set protocols ospf max-metric router-lsa on-startup 10",
# "set protocols ospf log-adjacency-changes 'detail'",
# "set protocols ospf neighbor 192.0.11.12 priority 2",
# "set protocols ospf neighbor 192.0.11.12 poll-interval 10",
# "set protocols ospf neighbor 192.0.11.12",
# "set protocols ospf area '2'",
# "set protocols ospf area 2 authentication plaintext-password",
# "set protocols ospf area 2 shortcut enable",
# "set protocols ospf area 2 area-type normal",
# "set protocols ospf area '3'",
# "set protocols ospf area 3 area-type nssa",
# "set protocols ospf area 4 range 192.0.3.0/24 cost 10",
# "set protocols ospf area 4 range 192.0.3.0/24",
# "set protocols ospf area 4 range 192.0.4.0/24 cost 12",
# "set protocols ospf area 4 range 192.0.4.0/24",
# "set protocols ospf area 4 area-type stub default-cost 20",
# "set protocols ospf area '4'",
# "set protocols ospf area 4 network 192.0.2.0/24"
# ]
# Using parsed
#
#
- name: Parse the commands for provided structured configuration
vyos.vyos.vyos_ospfv2:
running_config:
"set protocols ospf area 2 area-type 'normal'
set protocols ospf area 2 authentication 'plaintext-password'
set protocols ospf area 2 shortcut 'enable'
set protocols ospf area 3 area-type 'nssa'
set protocols ospf area 4 area-type stub default-cost '20'
set protocols ospf area 4 network '192.0.2.0/24'
set protocols ospf area 4 range 192.0.3.0/24 cost '10'
set protocols ospf area 4 range 192.0.4.0/24 cost '12'
set protocols ospf auto-cost reference-bandwidth '2'
set protocols ospf default-information originate 'always'
set protocols ospf default-information originate metric '10'
set protocols ospf default-information originate metric-type '2'
set protocols ospf default-information originate route-map 'ingress'
set protocols ospf log-adjacency-changes 'detail'
set protocols ospf max-metric router-lsa 'administrative'
set protocols ospf max-metric router-lsa on-shutdown '10'
set protocols ospf max-metric router-lsa on-startup '10'
set protocols ospf mpls-te 'enable'
set protocols ospf mpls-te router-address '192.0.11.11'
set protocols ospf neighbor 192.0.11.12 poll-interval '10'
set protocols ospf neighbor 192.0.11.12 priority '2'
set protocols ospf parameters abr-type 'cisco'
set protocols ospf parameters 'opaque-lsa'
set protocols ospf parameters 'rfc1583-compatibility'
set protocols ospf parameters router-id '192.0.1.1'
set protocols ospf passive-interface 'eth1'
set protocols ospf passive-interface 'eth2'
set protocols ospf redistribute bgp metric '10'
set protocols ospf redistribute bgp metric-type '2'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
# }
# Using gathered
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
#
- name: Gather ospfv2 routes config with provided configurations
vyos.vyos.vyos_ospfv2:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using deleted
#
# Before state
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
#
- name: Delete attributes of ospfv2 routes.
vyos.vyos.vyos_ospfv2:
config:
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
# "commands": [
# "delete protocols ospf"
# ]
#
# "after": {}
# After state
# ------------
# vyos@192# run show configuration commands | grep ospf
#
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The resulting configuration model invocation. Returned: when changed Sample: |
|
The configuration prior to the model invocation. Returned: always Sample: |
|
The set of commands pushed to the remote device. Returned: always Sample: |