Resource module to configure OSPFv2.
Version added: 1.0.0
- This module manages global OSPFv2 configuration on devices running Cisco IOS-XR
Note
- This module works with connection
network_cli
. See the IOS-XR Platform Options
# Using merged
# Before state:
# -------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 15:54:44.569 UTC
# % No such configuration item(s)
#
- name: Merge provided OSPFv2 configuration with the existing configuration
cisco.iosxr.iosxr_ospfv2:
config:
processes:
- process_id: '27'
areas:
- area_id: '10'
hello_interval: 2
authentication:
keychain: ansi11393
- process_id: '26'
adjacency_stagger:
max_adjacency: 20
min_adjacency: 10
- process_id: '10'
authentication:
keychain: ansible_test1102
areas:
- area_id: '11'
default_cost: 5
cost: 11
- area_id: 22
default_cost: 6
- process_id: '30'
areas:
- area_id: 11
default_cost: 5
- area_id: 22
default_cost: 6
cost: 2
default_metric: 10
transmit_delay: 2
hello_interval: 1
dead_interval: 2
retransmit_interval: 2
weight: 2
packet_size: 577
priority: 1
router_id: 2.2.2.2
demand_circuit: enable
passive: disable
summary_in: enable
flood_reduction: disable
mtu_ignore: enable
external_out: disable
state: merged
# Task Output:
# ------------
#
# before: {}
#
# commands:
# - router ospf 30
# - cost 2
# - weight 2
# - passive disable
# - priority 1
# - flood-reduction disable
# - default-metric 10
# - router-id 2.2.2.2
# - demand-circuit enable
# - packet-size 577
# - transmit-delay 2
# - summary-in enable
# - external-out disable
# - dead-interval 2
# - hello-interval 1
# - retransmit-interval 2
# - mtu-ignore enable
# - area 11 default-cost 5
# - area 22 default-cost 6
# - router ospf 26
# - adjacency stagger 10 20
# - router ospf 10
# - authentication keychain ansible_test1102
# - area 11 default-cost 5
# - area 11 cost 11
# - area 22 default-cost 6
# - router ospf 27
# - area 10 authentication keychain ansi11393
# - area 10 hello-interval 2
#
# after:
# processes:
# - areas:
# - area_id: '11'
# cost: 11
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# authentication:
# keychain: ansible_test1102
# process_id: '10'
# - adjacency_stagger:
# max_adjacency: 20
# min_adjacency: 10
# process_id: '26'
# - areas:
# - area_id: '10'
# authentication:
# keychain: ansi11393
# hello_interval: 2
# process_id: '27'
# - areas:
# - area_id: '11'
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# cost: 2
# dead_interval: 2
# default_metric: 10
# demand_circuit: enable
# external_out: disable
# flood_reduction: disable
# hello_interval: 1
# mtu_ignore: enable
# packet_size: 577
# passive: disable
# priority: 1
# process_id: '30'
# retransmit_interval: 2
# router_id: 2.2.2.2
# summary_in: enable
# transmit_delay: 2
# weight: 2
#
# After state:
# ------------
#
# router ospf 10
# authentication keychain ansible_test1102
# area 11
# cost 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
# router ospf 26
# adjacency stagger 10 20
# !
# router ospf 27
# area 10
# authentication keychain ansi11393
# hello-interval 2
# !
# !
# router ospf 30
# router-id 2.2.2.2
# summary-in enable
# external-out disable
# cost 2
# packet-size 577
# weight 2
# passive disable
# priority 1
# mtu-ignore enable
# flood-reduction disable
# dead-interval 2
# retransmit-interval 2
# demand-circuit enable
# hello-interval 1
# transmit-delay 2
# default-metric 10
# area 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
# Using replaced
#
# Before state:
# -------------
#
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:06:44.406 UTC
# router ospf 10
# authentication keychain ansible_test1102
# area 11
# cost 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
# router ospf 26
# adjacency stagger 10 20
# !
# router ospf 27
# area 10
# authentication keychain ansi11393
# hello-interval 2
# !
# !
# router ospf 30
# router-id 2.2.2.2
# summary-in enable
# external-out disable
# cost 2
# packet-size 577
# weight 2
# passive disable
# priority 1
# mtu-ignore enable
# flood-reduction disable
# dead-interval 2
# retransmit-interval 2
# demand-circuit enable
# hello-interval 1
# transmit-delay 2
# default-metric 10
# area 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
#
- name: Replace running OSPFv2 routes configurations with provided config.
cisco.iosxr.iosxr_ospfv2:
config:
processes:
- process_id: 27
areas:
- area_id: 10
hello_interval: 2
- area_id: 20
cost: 2
default_cost: 2
authentication:
keychain: ansi11393
- process_id: 26
adjacency_stagger:
min_adjacency: 10
max_adjacency: 20
state: replaced
# Task Output:
# ------------
#
# before:
# processes:
# - areas:
# - area_id: '11'
# cost: 11
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# authentication:
# keychain: ansible_test1102
# process_id: '10'
# - adjacency_stagger:
# max_adjacency: 20
# min_adjacency: 10
# process_id: '26'
# - areas:
# - area_id: '10'
# authentication:
# keychain: ansi11393
# hello_interval: 2
# process_id: '27'
# - areas:
# - area_id: '11'
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# cost: 2
# dead_interval: 2
# default_metric: 10
# demand_circuit: enable
# external_out: disable
# flood_reduction: disable
# hello_interval: 1
# mtu_ignore: enable
# packet_size: 577
# passive: disable
# priority: 1
# process_id: '30'
# retransmit_interval: 2
# router_id: 2.2.2.2
# summary_in: enable
# transmit_delay: 2
# weight: 2
#
# commands:
# - router ospf 27
# - no area 10 authentication keychain ansi11393
# - area 20 authentication keychain ansi11393
# - area 20 default-cost 2
# - area 20 cost 2
#
# after:
# processes:
# - areas:
# - area_id: '11'
# cost: 11
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# authentication:
# keychain: ansible_test1102
# process_id: '10'
# - adjacency_stagger:
# max_adjacency: 20
# min_adjacency: 10
# process_id: '26'
# - areas:
# - area_id: '10'
# hello_interval: 2
# - area_id: '20'
# authentication:
# keychain: ansi11393
# cost: 2
# default_cost: 2
# process_id: '27'
# - areas:
# - area_id: '11'
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# cost: 2
# dead_interval: 2
# default_metric: 10
# demand_circuit: enable
# external_out: disable
# flood_reduction: disable
# hello_interval: 1
# mtu_ignore: enable
# packet_size: 577
# passive: disable
# priority: 1
# process_id: '30'
# retransmit_interval: 2
# router_id: 2.2.2.2
# summary_in: enable
# transmit_delay: 2
# weight: 2
#
# After state:
# ------------
#
# RP/0/RP0/CPU0:anton(config)#do show running-config router ospf
# Thu Jun 11 16:40:31.038 UTC
# router ospf 10
# authentication keychain ansible_test1102
# area 11
# cost 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
# router ospf 26
# adjacency stagger 10 20
# !
# router ospf 27
# area 10
# hello-interval 2
# !
# area 20
# cost 2
# authentication keychain ansi11393
# default-cost 2
# !
# !
# router ospf 30
# router-id 2.2.2.2
# summary-in enable
# external-out disable
# cost 2
# packet-size 577
# weight 2
# passive disable
# priority 1
# mtu-ignore enable
# flood-reduction disable
# dead-interval 2
# retransmit-interval 2
# demand-circuit enable
# hello-interval 1
# transmit-delay 2
# default-metric 10
# area 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
# Using overridden
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:06:44.406 UTC
# router ospf 10
# authentication keychain ansible_test1102
# area 11
# cost 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
# router ospf 26
# adjacency stagger 10 20
# !
# router ospf 27
# area 10
# hello-interval 2
# !
# area 20
# cost 2
# authentication keychain ansi11393
# default-cost 2
# !
# !
# router ospf 30
# router-id 2.2.2.2
# summary-in enable
# external-out disable
# cost 2
# packet-size 577
# weight 2
# passive disable
# priority 1
# mtu-ignore enable
# flood-reduction disable
# dead-interval 2
# retransmit-interval 2
# demand-circuit enable
# hello-interval 1
# transmit-delay 2
# default-metric 10
# area 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
- name: Override existing OSPFv2 configurations with provided config.
cisco.iosxr.iosxr_ospfv2:
config:
processes:
- process_id: 27
areas:
- area_id: 10
hello_interval: 2
authentication:
keychain: ansi11393
- area_id: 20
cost: 2
default_cost: 2
authentication:
keychain: ansi11393
- process_id: 26
adjacency_stagger:
min_adjacency: 10
max_adjacency: 20
state: overridden
#
# Task Output:
# ------------
#
# before:
# processes:
# - areas:
# - area_id: '11'
# cost: 11
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# authentication:
# keychain: ansible_test1102
# process_id: '10'
# - adjacency_stagger:
# max_adjacency: 20
# min_adjacency: 10
# process_id: '26'
# - areas:
# - area_id: '10'
# hello_interval: 2
# - area_id: '20'
# authentication:
# keychain: ansi11393
# cost: 2
# default_cost: 2
# process_id: '27'
# - areas:
# - area_id: '11'
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# cost: 2
# dead_interval: 2
# default_metric: 10
# demand_circuit: enable
# external_out: disable
# flood_reduction: disable
# hello_interval: 1
# mtu_ignore: enable
# packet_size: 577
# passive: disable
# priority: 1
# process_id: '30'
# retransmit_interval: 2
# router_id: 2.2.2.2
# summary_in: enable
# transmit_delay: 2
# weight: 2
#
# commands:
# - router ospf 10
# - no authentication keychain ansible_test1102
# - no area 11 default-cost 5
# - no area 11 cost 11
# - no area 22 default-cost 6
# - router ospf 30
# - no cost 2
# - no weight 2
# - no passive disable
# - no priority 1
# - no flood-reduction disable
# - no default-metric 10
# - no router-id 2.2.2.2
# - no demand-circuit enable
# - no packet-size 577
# - no transmit-delay 2
# - no summary-in enable
# - no external-out disable
# - no dead-interval 2
# - no hello-interval 1
# - no retransmit-interval 2
# - no mtu-ignore enable
# - no area 11 default-cost 5
# - no area 22 default-cost 6
# - router ospf 27
# - area 10 authentication keychain ansi11393
#
# after:
# processes:
# - process_id: '10'
# - adjacency_stagger:
# max_adjacency: 20
# min_adjacency: 10
# process_id: '26'
# - areas:
# - area_id: '10'
# authentication:
# keychain: ansi11393
# hello_interval: 2
# - area_id: '20'
# authentication:
# keychain: ansi11393
# cost: 2
# default_cost: 2
# process_id: '27'
# - process_id: '30'
#
# After state:
# ------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:50:36.332 UTC
# router ospf 10
# area 11
# !
# area 22
# !
# !
# router ospf 26
# adjacency stagger 10 20
# !
# router ospf 27
# area 10
# authentication keychain ansi11393
# hello-interval 2
# !
# area 20
# cost 2
# authentication keychain ansi11393
# default-cost 2
# !
# !
# router ospf 30
# area 11
# !
# area 22
# !
# !
#
# Using deleted
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:06:44.406 UTC
# router ospf 10
# authentication keychain ansible_test1102
# area 11
# cost 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
# router ospf 26
# adjacency stagger 10 20
# !
# router ospf 27
# area 10
# authentication keychain ansi11393
# hello-interval 2
# !
# area 20
# cost 2
# authentication keychain ansi11393
# default-cost 2
# !
# !
# router ospf 30
# router-id 2.2.2.2
# summary-in enable
# external-out disable
# cost 2
# packet-size 577
# weight 2
# passive disable
# priority 1
# mtu-ignore enable
# flood-reduction disable
# dead-interval 2
# retransmit-interval 2
# demand-circuit enable
# hello-interval 1
# transmit-delay 2
# default-metric 10
# area 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
- name: Deleted provided ospfv2 processes.
cisco.iosxr.iosxr_ospfv2:
config:
processes:
- process_id: '10'
- process_id: '26'
- process_id: '27'
- process_id: '30'
state: deleted
#
# Task Output:
# ------------
#
# before:
# processes:
# - areas:
# - area_id: '11'
# cost: 11
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# authentication:
# keychain: ansible_test1102
# process_id: '10'
# - adjacency_stagger:
# max_adjacency: 20
# min_adjacency: 10
# process_id: '26'
# - areas:
# - area_id: '10'
# authentication:
# keychain: ansi11393
# hello_interval: 2
# - area_id: '20'
# authentication:
# keychain: ansi11393
# cost: 2
# default_cost: 2
# process_id: '27'
# - areas:
# - area_id: '11'
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# cost: 2
# dead_interval: 2
# default_metric: 10
# demand_circuit: enable
# external_out: disable
# flood_reduction: disable
# hello_interval: 1
# mtu_ignore: enable
# packet_size: 577
# passive: disable
# priority: 1
# process_id: '30'
# retransmit_interval: 2
# router_id: 2.2.2.2
# summary_in: enable
# transmit_delay: 2
# weight: 2
#
# commands:
# - router ospf 10
# - no authentication keychain ansible_test1102
# - no area 11 default-cost 5
# - no area 11 cost 11
# - no area 22 default-cost 6
# - router ospf 26
# - no adjacency stagger 10 20
# - router ospf 27
# - no area 10 authentication keychain ansi11393
# - no area 10 hello-interval 2
# - no area 20 authentication keychain ansi11393
# - no area 20 default-cost 2
# - no area 20 cost 2
# - router ospf 30
# - no cost 2
# - no weight 2
# - no passive disable
# - no priority 1
# - no flood-reduction disable
# - no default-metric 10
# - no router-id 2.2.2.2
# - no demand-circuit enable
# - no packet-size 577
# - no transmit-delay 2
# - no summary-in enable
# - no external-out disable
# - no dead-interval 2
# - no hello-interval 1
# - no retransmit-interval 2
# - no mtu-ignore enable
# - no area 11 default-cost 5
# - no area 22 default-cost 6
#
# after:
# processes:
# - process_id: '10'
# - process_id: '26'
# - process_id: '27'
# - process_id: '30'
# After state:
# ------------
#
# RP/0/RP0/CPU0:anton(config)#show running-config router ospf
# Thu Jun 11 17:07:34.218 UTC
# router ospf 10
# area 11
# !
# area 22
# !
# !
# router ospf 26
# !
# router ospf 27
# area 10
# !
# area 20
# !
# !
# router ospf 30
# area 11
# !
# area 22
# !
# !
# Using parsed
# parsed.cfg
# ------------
# Thu Jun 11 17:28:51.918 UTC
# router ospf 10
# authentication keychain ansible_test1102
# area 11
# cost 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
# router ospf 26
# authentication message-digest keychain ansible1101pass
# adjacency stagger 10 20
# !
# router ospf 27
# area 10
# authentication keychain ansi11393
# hello-interval 2
# !
# !
# router ospf 30
# router-id 2.2.2.2
# summary-in enable
# external-out disable
# cost 2
# packet-size 577
# weight 2
# passive disable
# priority 1
# mtu-ignore enable
# flood-reduction disable
# dead-interval 2
# retransmit-interval 2
# demand-circuit enable
# hello-interval 1
# transmit-delay 2
# default-metric 10
# area 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
#
- name: Parsed the device configuration to get output commands
cisco.iosxr.iosxr_ospfv2:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
#
# Task Output:
# ------------
#
# parsed:
# processes:
# - areas:
# - area_id: '11'
# cost: 11
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# authentication:
# keychain: ansible_test1102
# process_id: '10'
# - adjacency_stagger:
# max_adjacency: 20
# min_adjacency: 10
# authentication:
# message_digest:
# keychain: ansible1101pass
# process_id: '26'
# - areas:
# - area_id: '10'
# authentication:
# keychain: ansi11393
# hello_interval: 2
# process_id: '27'
# - areas:
# - area_id: '11'
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# cost: 2
# dead_interval: 2
# default_metric: 10
# demand_circuit: enable
# external_out: disable
# flood_reduction: disable
# hello_interval: 1
# mtu_ignore: enable
# packet_size: 577
# passive: disable
# priority: 1
# process_id: '30'
# retransmit_interval: 2
# router_id: 2.2.2.2
# summary_in: enable
# transmit_delay: 2
# weight: 2
# Using rendered
#
- name: Render the commands for provided configuration
cisco.iosxr.iosxr_ospfv2:
config:
processes:
- process_id: 27
areas:
- area_id: 10
hello_interval: 2
authentication:
keychain: ansi11393
- process_id: 26
adjacency_stagger:
min_adjacency: 10
max_adjacency: 20
- process_id: 10
authentication:
keychain: ansible_test1102
areas:
- area_id: 11
default_cost: 5
cost: 11
- area_id: 22
default_cost: 6
- process_id: 30
areas:
- area_id: 11
default_cost: 5
- area_id: 22
default_cost: 6
cost: 2
default_metric: 10
transmit_delay: 2
hello_interval: 1
dead_interval: 2
retransmit_interval: 2
weight: 2
packet_size: 577
priority: 1
router_id: 2.2.2.2
demand_circuit: enable
passive: disable
summary_in: enable
flood_reduction: disable
mtu_ignore: enable
external_out: disable
state: rendered
#
# Task Output:
# ------------
#
# rendered:
# - router ospf 27
# - area 10 authentication keychain ansi11393
# - area 10 hello-interval 2
# - router ospf 26
# - adjacency stagger 10 20
# - router ospf 10
# - authentication keychain ansible_test1102
# - area 11 default-cost 5
# - area 11 cost 11
# - area 22 default-cost 6
# - router ospf 30
# - cost 2
# - weight 2
# - passive disable
# - priority 1
# - flood-reduction disable
# - default-metric 10
# - router-id 2.2.2.2
# - demand-circuit enable
# - packet-size 577
# - transmit-delay 2
# - summary-in enable
# - external-out disable
# - dead-interval 2
# - hello-interval 1
# - retransmit-interval 2
# - mtu-ignore enable
# - area 11 default-cost 5
# - area 22 default-cost 6
# Using gathered
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:06:44.406 UTC
# router ospf 10
# authentication keychain ansible_test1102
# area 11
# cost 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
# router ospf 26
# adjacency stagger 10 20
# !
# router ospf 27
# area 10
# authentication keychain ansi11393
# hello-interval 2
# !
# area 20
# !
# !
# router ospf 30
# router-id 2.2.2.2
# summary-in enable
# external-out disable
# cost 2
# packet-size 577
# weight 2
# passive disable
# priority 1
# mtu-ignore enable
# flood-reduction disable
# dead-interval 2
# retransmit-interval 2
# demand-circuit enable
# hello-interval 1
# transmit-delay 2
# default-metric 10
# area 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
#
- name: Gather ospfv2 routes configuration
cisco.iosxr.iosxr_ospfv2:
state: gathered
#
#
# Task Output:
# ------------
#
# gathered:
# processes:
# - areas:
# - area_id: '11'
# cost: 11
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# authentication:
# keychain: ansible_test1102
# process_id: '10'
# - adjacency_stagger:
# max_adjacency: 20
# min_adjacency: 10
# process_id: '26'
# - areas:
# - area_id: '10'
# authentication:
# keychain: ansi11393
# hello_interval: 2
# process_id: '27'
# - areas:
# - area_id: '11'
# default_cost: 5
# - area_id: '22'
# default_cost: 6
# cost: 2
# dead_interval: 2
# default_metric: 10
# demand_circuit: enable
# external_out: disable
# flood_reduction: disable
# hello_interval: 1
# mtu_ignore: enable
# packet_size: 577
# passive: disable
# priority: 1
# process_id: '30'
# retransmit_interval: 2
# router_id: 2.2.2.2
# summary_in: enable
# transmit_delay: 2
# weight: 2
#
# After state:
# -------------
#
# RP/0/RP0/CPU0:anton#show running-config router ospf
# Thu Jun 11 16:06:44.406 UTC
# router ospf 10
# authentication keychain ansible_test1102
# area 11
# cost 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
# router ospf 26
# authentication message-digest keychain ansible1101pass
# adjacency stagger 10 20
# !
# router ospf 27
# area 10
# authentication keychain ansi11393
# hello-interval 2
# !
# !
# router ospf 30
# router-id 2.2.2.2
# summary-in enable
# external-out disable
# cost 2
# packet-size 577
# weight 2
# passive disable
# priority 1
# mtu-ignore enable
# flood-reduction disable
# dead-interval 2
# retransmit-interval 2
# demand-circuit enable
# hello-interval 1
# transmit-delay 2
# default-metric 10
# area 11
# default-cost 5
# !
# area 22
# default-cost 6
# !
# !
#
Common return values are documented here, the following are the fields unique to this module:
- Rohit Thakur (@rohitthakur2590)