cisco.iosxr.iosxr_ospf_interfaces – OSPF Interfaces Resource Module.¶
Note
This plugin is part of the cisco.iosxr collection (version 1.2.1).
To install it use: ansible-galaxy collection install cisco.iosxr
.
To use it in a playbook, specify: cisco.iosxr.iosxr_ospf_interfaces
.
New in version 1.2.0: of cisco.iosxr
Synopsis¶
This module manages OSPF(v2/v3) configuration of interfaces on devices running Cisco IOS-XR.
Note
This module has a corresponding action plugin.
Parameters¶
Notes¶
Note
Tested against IOS-XR 6.1.3
This module works with connection
network_cli
. See the IOS-XR Platform Options
Examples¶
# Using merged
# Before state:
# -------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# % No such configuration item(s)
#
- name: Merge provided OSPF interfaces configuration with the existing configuration
cisco.iosxr.iosxr_ospf_interfaces:
config:
- name: GigabitEthernet0/0/0/0
type: gigabitethernet
address_family:
- afi: ipv4
processes:
- process_id: "LAB3"
area:
area_id: 0.0.0.3
cost: 20
authentication:
message_digest:
keychain: cisco
- afi: ipv6
processes:
- process_id: "LAB3"
area:
area_id: 0.0.0.2
cost: 30
state: merged
#
#
# ------------------------
# Module Execution Result
# ------------------------
#
# "before": []
#
# "commands": [
# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 20",
# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest",
# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain cisco",
# "router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0 cost 30"
# ]
#
# "after": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "message_digest": {
# "keychain": "cisco"
# }
# },
# "cost": 20,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.3"
# },
# "process_id": "LAB3"
# }
# ]
# },
# {
# "afi": "ipv6",
# "cost": 30,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.2"
# },
# "process_id": "LAB3"
# }
# ]
# }
# ],
# "name": "GigabitEthernet0/0/0/0",
# "type": "gigabitethernet"
# }
# ]
#
#
# ------------
# After state
# ------------
#
# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf
# Thu Oct 23 06:00:57.217 UTC
# router ospf LAB
# area 0.0.0.0
# !
# area 0.0.0.9
# !
# !
# router ospf LAB1
# area 0.0.0.1
# !
# area 0.0.0.3
# !
# !
# router ospf LAB3
# area 0.0.0.3
# interface GigabitEthernet0/0/0/0
# cost 20
# authentication message-digest keychain cisco
# !
# !
# !
# router ospf ipv4
# !
# Using replaced
#
# ------------
# Before state
# ------------
#
#
# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf
# Thu Oct 23 06:00:57.217 UTC
# router ospf LAB
# area 0.0.0.0
# !
# area 0.0.0.9
# !
# !
# router ospf LAB1
# area 0.0.0.1
# !
# area 0.0.0.3
# !
# !
# router ospf LAB3
# area 0.0.0.3
# interface GigabitEthernet0/0/0/0
# cost 20
# authentication message-digest keychain cisco
# !
# !
# !
# router ospf ipv4
# !
- name: Replace OSPF interfaces configuration
cisco.iosxr.iosxr_ospf_interfaces:
config:
- name: GigabitEthernet0/0/0/0
type: gigabitethernet
address_family:
- afi: ipv4
processes:
- process_id: "LAB3"
area:
area_id: 0.0.0.3
cost: 30
authentication:
message_digest:
keychain: ciscoiosxr
- afi: ipv6
processes:
- process_id: "LAB3"
area:
area_id: 0.0.0.2
cost: 30
state: replaced
#
#
# ------------------------
# Module Execution Result
# ------------------------
#
# "before": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "message_digest": {
# "keychain": "cisco"
# }
# },
# "cost": 20,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.3"
# },
# "process_id": "LAB3"
# }
# ]
# },
# {
# "afi": "ipv6",
# "cost": 30,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.2"
# },
# "process_id": "LAB3"
# }
# ]
# }
# ],
# "name": "GigabitEthernet0/0/0/0",
# "type": "gigabitethernet"
# }
# ]
#
# "commands": [
# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 30",
# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest",
# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain ciscoiosxr"
# ]
#
# "after": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "message_digest": {
# "keychain": "ciscoiosxr"
# }
# },
# "cost": 30,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.3"
# },
# "process_id": "LAB3"
# }
# ]
# },
# {
# "afi": "ipv6",
# "cost": 30,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.2"
# },
# "process_id": "LAB3"
# }
# ]
# }
# ],
# "name": "GigabitEthernet0/0/0/0",
# "type": "gigabitethernet"
# }
# ]
#
#
# -----------
# After state
# -----------
#
# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf
# Thu Oct 23 06:10:39.827 UTC
# router ospf LAB
# area 0.0.0.0
# !
# area 0.0.0.9
# !
# !
# router ospf LAB1
# area 0.0.0.1
# !
# area 0.0.0.3
# !
# !
# router ospf LAB3
# area 0.0.0.3
# interface GigabitEthernet0/0/0/0
# cost 30
# authentication message-digest keychain ciscoiosxr
# !
# !
# !
# router ospf ipv4
# !
- name: Override existing OSPF interfaces configuration
cisco.iosxr.iosxr_ospf_interfaces:
config:
- name: GigabitEthernet0/0/0/1
type: gigabitethernet
address_family:
- afi: ipv4
processes:
- process_id: "LAB1"
area:
area_id: 0.0.0.3
cost: 10
authentication:
message_digest:
keychain: iosxr
state: overridden
#
#
# ------------------------
# Module Execution Result
# ------------------------
#
# "before": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "message_digest": {
# "keychain": "ciscoiosxr"
# }
# },
# "cost": 30,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.3"
# },
# "process_id": "LAB3"
# }
# ]
# },
# {
# "afi": "ipv6",
# "cost": 30,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.2"
# },
# "process_id": "LAB3"
# }
# ]
# }
# ],
# "name": "GigabitEthernet0/0/0/0",
# "type": "gigabitethernet"
# }
# ]
#
# "commands": [
# "no router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0",
# "no router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0",
# "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 cost 10",
# "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest",
# "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest keychain iosxr"
# ]
#
# "after": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "message_digest": {
# "keychain": "iosxr"
# }
# },
# "cost": 10,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.3"
# },
# "process_id": "LAB1"
# }
# ]
# }
# ],
# "name": "GigabitEthernet0/0/0/1",
# "type": "gigabitethernet"
# }
# ]
#
#
# -----------
# After state
# -----------
#
# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf
# Thu Oct 23 06:28:15.025 UTC
# router ospf LAB
# area 0.0.0.0
# !
# area 0.0.0.9
# !
# !
# router ospf LAB1
# area 0.0.0.1
# !
# area 0.0.0.3
# interface GigabitEthernet0/0/0/1
# cost 10
# authentication message-digest keychain iosxr
# !
# !
# !
# router ospf LAB3
# area 0.0.0.3
# !
# !
# router ospf ipv4
# !
# Using deleted
#
# ------------
# Before state
# ------------
#
#
# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf
# Thu Oct 23 06:28:15.025 UTC
# router ospf LAB
# area 0.0.0.0
# !
# area 0.0.0.9
# !
# !
# router ospf LAB1
# area 0.0.0.1
# !
# area 0.0.0.3
# interface GigabitEthernet0/0/0/1
# cost 10
# authentication message-digest keychain iosxr
# !
# !
# !
# router ospf LAB3
# area 0.0.0.3
# !
# !
# router ospf ipv4
# !
- name: Deleted existing OSPF interfaces from the device
cisco.iosxr.iosxr_ospf_interfaces:
config:
- name: GigabitEthernet0/0/0/1
type: gigabitethernet
state: deleted
#
#
# ------------------------
# Module Execution Result
# ------------------------
#
# "before": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "message_digest": {
# "keychain": "iosxr"
# }
# },
# "cost": 10,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.3"
# },
# "process_id": "LAB1"
# }
# ]
# }
# ],
# "name": "GigabitEthernet0/0/0/1",
# "type": "gigabitethernet"
# }
# ],
#
# "commands": [
# "no router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1"
# ]
#
# "after": []
#
#
# -----------
# After state
# -----------
#
# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf
# Thu Oct 23 06:34:38.319 UTC
# router ospf LAB
# area 0.0.0.0
# !
# area 0.0.0.9
# !
# !
# router ospf LAB1
# area 0.0.0.1
# !
# area 0.0.0.3
# !
# !
# router ospf LAB3
# area 0.0.0.3
# !
# !
# router ospf ipv4
# !
# Using parsed
# parsed.cfg
# ------------
# router ospf LAB
# area 0.0.0.0
# !
# area 0.0.0.9
# !
# !
# router ospf LAB1
# area 0.0.0.1
# !
# area 0.0.0.3
# !
# !
# router ospf LAB3
# area 0.0.0.3
# interface GigabitEthernet0/0/0/0
# cost 20
# authentication message-digest keychain cisco
# !
# !
# !
# router ospf ipv4
# !
- name: Parsed the device configuration to get output commands
cisco.iosxr.iosxr_ospf_interfaces:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "message_digest": {
# "keychain": "cisco"
# }
# },
# "cost": 20,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.3"
# },
# "process_id": "LAB3"
# }
# ]
# }
# ],
# "name": "GigabitEthernet0/0/0/0",
# "type": "gigabitethernet"
# }
# ]
#
# Using rendered
#
#
- name: Render the commands for provided configuration
cisco.iosxr.iosxr_ospf_interfaces:
config:
- name: GigabitEthernet0/0/0/0
type: gigabitethernet
address_family:
- afi: ipv4
processes:
- process_id: "LAB3"
area:
area_id: 0.0.0.3
cost: 20
authentication:
message_digest:
keychain: cisco
- afi: ipv6
processes:
- process_id: "LAB3"
area:
area_id: 0.0.0.2
cost: 30
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 20",
# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest",
# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain cisco",
# "router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0 cost 30"
# ]
# Using gathered
#
# Before state:
# -------------
#
# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf
# Thu Oct 23 06:50:38.743 UTC
# router ospf LAB
# area 0.0.0.0
# !
# area 0.0.0.9
# !
# !
# router ospf LAB1
# area 0.0.0.1
# !
# area 0.0.0.3
# !
# !
# router ospf LAB3
# area 0.0.0.3
# interface GigabitEthernet0/0/0/0
# cost 20
# authentication message-digest keychain cisco
# !
# !
# !
# router ospf ipv4
# !
- name: Gather ospf_interfaces routes configuration
cisco.iosxr.iosxr_ospf_interfaces:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "address_family": [
# {
# "afi": "ipv4",
# "authentication": {
# "message_digest": {
# "keychain": "cisco"
# }
# },
# "cost": 20,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.3"
# },
# "process_id": "LAB3"
# }
# ]
# },
# {
# "afi": "ipv6",
# "cost": 30,
# "processes": [
# {
# "area": {
# "area_id": "0.0.0.2"
# },
# "process_id": "LAB3"
# }
# ]
# }
# ],
# "name": "GigabitEthernet0/0/0/0",
# "type": "gigabitethernet"
# }
# ]
#
Authors¶
Rohit Thakur (@rohitthakur2590)