junipernetworks.junos.junos_ospf_interfaces module – OSPF Interfaces Resource Module.
Note
This module is part of the junipernetworks.junos collection (version 9.1.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 junipernetworks.junos
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: junipernetworks.junos.junos_ospf_interfaces
.
New in junipernetworks.junos 1.3.0
Synopsis
This module manages OSPF(v2/v3) configuration of interfaces on devices running Juniper JUNOS.
Aliases: ospf_interfaces
Requirements
The below requirements are needed on the host that executes this module.
ncclient (>=v0.6.4)
xmltodict (>=0.12.0)
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:
|
|
Interfaces configuration for an OSPF process. |
|
Specify the area-id |
|
Specify area id. |
|
Specify authentication type |
|
Specify md5 based authentication. |
|
Specify md5 key-id |
|
Specify key value |
|
Specify start time for key transmission |
|
Specify password for authentication. |
|
Specify list of bandwidth based metrics |
|
BW to apply metric to. Choices:
|
|
Specify metric |
|
Dead interval (seconds). |
|
Interface functions as a demand circuit. Choices:
|
|
Enable flood reduction. Choices:
|
|
Hello interval (seconds). |
|
Specify type of interface Choices:
|
|
IPSec security association name |
|
Metric applied to the interface. |
|
Maximum OSPF packet size |
|
Do not advertise an adjacency segment for this interface. Choices:
|
|
Not eligible to backup traffic from protected interfaces. Choices:
|
|
Not eligible for Remote-LFA backup traffic from protected interfaces. Choices:
|
|
Do not send interface state change traps. Choices:
|
|
Don’t inform other protocols about neighbor down events. Choices:
|
|
Protect interface from both link and node faults. Choices:
|
|
Do not run OSPF, but advertise it. Choices:
|
|
Poll interval (seconds). |
|
Priority for the interface. |
|
Retransmit interval (seconds). |
|
Treat interface as secondary Choices:
|
|
Traffic engineering metric applied to the interface. |
|
Transit delay (seconds). |
|
Name/Identifier of the interface. |
|
The OSPF router id. |
|
This option is used only with state parsed. The value of this option should be the output received from the Junos device by executing the command show protocols ospf. The state parsed reads the configuration from |
|
The state the configuration should be left in. Choices:
|
Notes
Note
This module requires the netconf system service be enabled on the device being managed.
This module works with connection
netconf
. See the Junos OS Platform Options.Tested against JunOS v18.4R1
Examples
# Using merged
#
# Before state
# ------------
#
# admin# show protocols ospf
- name: Merge Junos OSPF interfaces config
junipernetworks.junos.junos_ospf_interfaces:
config:
- name: 'ge-0/0/2.0'
address_family:
- afi: 'ipv4'
processes:
area:
area_id: '0.0.0.2'
priority: 3
metric: 5
state: merged
# After state
# -----------
#
# admin# show protocols ospf
# area 0.0.0.2 {
# interface ge-0/0/2.0 {
# metric 5;
# priority 3;
# }
# }
# Using replaced
#
# Before state
# ------------
#
# admin# show protocols ospf
# area 0.0.0.2 {
# interface ge-0/0/2.0 {
# metric 5;
# priority 3;
# }
# }
- name: Replace Junos OSPF interfaces config
junipernetworks.junos.junos_ospf_interfaces:
config:
- name: 'ge-0/0/2.0'
address_family:
- afi: 'ipv4'
processes:
area:
area_id: '0.0.0.1'
priority: 6
metric: 6
state: replaced
# After state
# -----------
#
# admin# show protocols ospf
# area 0.0.0.1 {
# interface ge-0/0/2.0 {
# metric 6;
# priority 6;
# }
# }
# Using overridden
#
# Before state
# ------------
#
# admin# show protocols ospf
# area 0.0.0.3 {
# interface ge-0/0/3.0 {
# metric 5;
# priority 3;
# }
# }
# area 0.0.0.2 {
# interface ge-0/0/2.0 {
# metric 5;
# priority 3;
# }
# }
- name: Override Junos OSPF interfaces config
junipernetworks.junos.junos_ospf_interfaces:
config:
- name: 'ge-0/0/1.0'
address_family:
- afi: 'ipv4'
processes:
area:
area_id: '0.0.0.1'
priority: 3
metric: 5
state: overridden
# After state
# -----------
#
# admin# show protocols ospf
# area 0.0.0.1 {
# interface ge-0/0/1.0 {
# metric 5;
# priority 3;
# }
# }
#
# Using deleted
#
# Before state
# ------------
#
# admin# show protocols ospf
# area 0.0.0.1 {
# interface ge-0/0/1.0 {
# metric 5;
# priority 3;
# }
# }
- name: Delete Junos OSPF interfaces config
junipernetworks.junos.junos_ospf_interfaces:
config:
- name: 'ge-0/0/1.0'
state: deleted
# After state
# -----------
#
# admin# show protocols ospf
# Using gathered
#
# Before state
# ------------
#
# admin# show protocols ospf
# area 0.0.0.3 {
# interface ge-0/0/3.0 {
# metric 5;
# priority 3;
# }
# }
# area 0.0.0.2 {
# interface ge-0/0/2.0 {
# metric 5;
# priority 3;
# }
# }
- name: Gather Junos OSPF interfaces config
junipernetworks.junos.junos_ospf_interfaces:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "processes": {
# "area": {
# "area_id": "0.0.0.3"
# },
# "metric": 5,
# "priority": 3
# }
# }
# ],
# "name": "ge-0/0/3.0",
# },
# {
# "address_family": [
# {
# "afi": "ipv4",
# "processes": {
# "area": {
# "area_id": "0.0.0.2"
# },
# "metric": 5,
# "priority": 3
# }
# }
# ],
# "name": "ge-0/0/2.0",
# }
# ]
#
# Using rendered
#
#
- name: Render the commands for provided configuration
junipernetworks.junos.junos_ospf_interfaces:
config:
- name: 'ge-0/0/2.0'
address_family:
- afi: 'ipv4'
processes:
area:
area_id: '0.0.0.2'
priority: 3
metric: 5
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": "
# <nc:protocols
# xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
# <nc:ospf>
# <nc:area>
# <nc:name>0.0.0.2</nc:name>
# <nc:interface>
# <nc:name>ge-0/0/2.0</nc:name>
# <nc:priority>3</nc:priority>
# <nc:metric>5</nc:metric>
# </nc:interface>
# </nc:area>
# </nc:ospf>
# </nc:protocols>"
#
# Using parsed
# parsed.cfg
# ------------
# <?xml version="1.0" encoding="UTF-8"?>
# <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f">
# <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC">
# <protocols>
# <ospf>
# <area>
# <name>0.0.0.2</name>
# <stub>
# <default-metric>200</default-metric>
# </stub>
# <interface>
# <name>ge-0/0/2.0</name>
# <metric>5</metric>
# <priority>3</priority>
# </interface>
# </area>
# </ospf>
# </protocols>
# <routing-options>
# <router-id>10.200.16.75</router-id>
# </routing-options>
# </configuration>
# </rpc-reply>
- name: Parsed the device configuration to get output commands
junipernetworks.junos.junos_ospf_interfaces:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "processes": {
# "area": {
# "area_id": "0.0.0.2"
# },
# "metric": 5,
# "priority": 3
# }
# }
# ],
# "name": "ge-0/0/2.0",
# }
# ]
#
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: |