W3cubDocs

/Ansible 2.10

cisco.nxos.nxos_ospfv2 – OSPFv2 resource module

Note

This plugin is part of the cisco.nxos collection.

To install it use: ansible-galaxy collection install cisco.nxos.

To use it in a playbook, specify: cisco.nxos.nxos_ospfv2.

New in version 1.0.0: of cisco.nxos

Synopsis

  • This module manages OSPFv2 configuration on devices running Cisco NX-OS.

Note

This module has a corresponding action plugin.

Parameters

Parameter Choices/Defaults Comments
config
dictionary
A list of OSPF process configuration.
processes
list / elements=dictionary
A list of OSPF instances' configurations.
areas
list / elements=dictionary
Configure properties of OSPF Areas.
area_id
string / required
The Area ID as an integer or IP Address.
authentication
dictionary
Authentication settings for the Area.
message_digest
boolean
    Choices:
  • no
  • yes
Use message-digest authentication.
set
boolean
    Choices:
  • no
  • yes
Set authentication for the area.
default_cost
integer
Specify the default cost for default summary LSA.
filter_list
list / elements=dictionary
Filter prefixes between OSPF areas.
direction
string / required
    Choices:
  • in
  • out
The direction to apply the route map.
route_map
string / required
The Route-map name.
nssa
dictionary
NSSA settings for the area.
default_information_originate
boolean
    Choices:
  • no
  • yes
Originate Type-7 default LSA into NSSA area.
no_redistribution
boolean
    Choices:
  • no
  • yes
Do not send redistributed LSAs into NSSA area.
no_summary
boolean
    Choices:
  • no
  • yes
Do not send summary LSAs into NSSA area.
set
boolean
    Choices:
  • no
  • yes
Configure area as NSSA.
translate
dictionary
Translate LSA.
type7
dictionary
Translate from Type 7 to Type 5.
always
boolean
    Choices:
  • no
  • yes
Always translate LSAs
never
boolean
    Choices:
  • no
  • yes
Never translate LSAs
supress_fa
boolean
    Choices:
  • no
  • yes
Suppress forwarding address in translated LSAs.
ranges
list / elements=dictionary
Configure an address range for the area.
cost
integer
Cost to use for the range.
not_advertise
boolean
    Choices:
  • no
  • yes
Suppress advertising the specified range.
prefix
string / required
IP in Prefix format (x.x.x.x/len)
stub
dictionary
Settings for configuring the area as a stub.
no_summary
boolean
    Choices:
  • no
  • yes
Prevent ABR from sending summary LSAs into stub area.
set
boolean
    Choices:
  • no
  • yes
Configure the area as a stub.
auto_cost
dictionary
Calculate OSPF cost according to bandwidth.
reference_bandwidth
integer / required
Reference bandwidth used to assign OSPF cost.
unit
string / required
    Choices:
  • Gbps
  • Mbps
Specify in which unit the reference bandwidth is specified.
bfd
boolean
    Choices:
  • no
  • yes
Enable BFD on all OSPF interfaces.
default_information
dictionary
Control distribution of default routes.
originate
dictionary
Distribute a default route.
always
boolean
    Choices:
  • no
  • yes
Always advertise a default route.
route_map
string
Policy to control distribution of default routes
set
boolean
    Choices:
  • no
  • yes
Enable distribution of default route.
default_metric
integer
Specify default metric for redistributed routes.
distance
integer
Configure the OSPF administrative distance.
flush_routes
boolean
    Choices:
  • no
  • yes
Flush routes on a non-graceful controlled restart.
graceful_restart
dictionary
Configure graceful restart.
grace_period
integer
Configure maximum interval to restart gracefully.
helper_disable
boolean
    Choices:
  • no
  • yes
Enable/Disable helper mode.
set
boolean
    Choices:
  • no
  • yes
Enable graceful-restart.
isolate
boolean
    Choices:
  • no
  • yes
Isolate this router from OSPF perspective.
log_adjacency_changes
dictionary
Log changes in adjacency state.
detail
boolean
    Choices:
  • no
  • yes
Notify all state changes.
log
boolean
    Choices:
  • no
  • yes
Enable/disable logging changes in adjacency state.
max_lsa
dictionary
Feature to limit the number of non-self-originated LSAs.
ignore_count
integer
Set count on how many times adjacencies can be suppressed.
ignore_time
integer
Set time during which all adjacencies are suppressed.
max_non_self_generated_lsa
integer / required
Set the maximum number of non self-generated LSAs.
reset_time
integer
Set number of minutes after which ignore-count is reset to zero.
threshold
integer
Threshold value (%) at which to generate a warning message.
warning_only
boolean
    Choices:
  • no
  • yes
Log a warning message when limit is exceeded.
max_metric
dictionary
Maximize the cost metric.
router_lsa
dictionary
Router LSA configuration.
external_lsa
dictionary
External LSA configuration.
max_metric_value
integer
Set max metric value for external LSAs.
set
boolean
    Choices:
  • no
  • yes
Set external-lsa attribute.
include_stub
boolean
    Choices:
  • no
  • yes
Advertise Max metric for Stub links as well.
on_startup
dictionary
Effective only at startup.
set
boolean
    Choices:
  • no
  • yes
Set on-startup attribute.
wait_for_bgp_asn
integer
ASN of BGP to wait for.
wait_period
integer
Wait period in seconds after startup.
set
boolean
    Choices:
  • no
  • yes
Set router-lsa attribute.
summary_lsa
dictionary
Summary LSAs configuration.
max_metric_value
integer
Max metric value for summary LSAs.
set
boolean
    Choices:
  • no
  • yes
Set summary-lsa attribute.
maximum_paths
integer
Maximum paths per destination.
mpls
dictionary
OSPF MPLS configuration settings.
traffic_eng
dictionary
OSPF MPLS Traffic Engineering commands.
areas
list / elements=dictionary
List of Area IDs.
area_id
string
Area Id as an integer or ip address.
multicast_intact
boolean
    Choices:
  • no
  • yes
MPLS TE multicast support.
router_id
string
Router ID associated with TE.
name_lookup
boolean
    Choices:
  • no
  • yes
Display OSPF router ids as DNS names.
passive_interface
dictionary
Suppress routing updates on the interface.
default
boolean
    Choices:
  • no
  • yes
Interfaces passive by default.
process_id
string / required
The OSPF process tag.
redistribute
list / elements=dictionary
Redistribute information from another routing protocol.
id
string
The identifier for the protocol specified.
protocol
string / required
    Choices:
  • bgp
  • direct
  • eigrp
  • isis
  • lisp
  • ospf
  • rip
  • static
The name of the protocol.
route_map
string / required
The route map policy to constrain redistribution.
rfc1583compatibility
boolean
    Choices:
  • no
  • yes
Configure 1583 compatibility for external path preferences.
router_id
string
Set OSPF process router-id.
shutdown
boolean
    Choices:
  • no
  • yes
Shutdown the OSPF protocol instance.
summary_address
list / elements=dictionary
Configure route summarization for redistribution.
not_advertise
boolean
    Choices:
  • no
  • yes
Supress advertising the specified summary.
prefix
string / required
IP prefix in format x.x.x.x/ml.
tag
integer
A 32-bit tag value.
table_map
dictionary
Policy for filtering/modifying OSPF routes before sending them to RIB.
filter
boolean
    Choices:
  • no
  • yes
Block the OSPF routes from being sent to RIB.
name
string / required
The Route Map name.
timers
dictionary
Configure timer related constants.
lsa_arrival
integer
Mimimum interval between arrival of a LSA.
lsa_group_pacing
integer
LSA group refresh/maxage interval.
throttle
dictionary
Configure throttle related constants.
lsa
dictionary
Set rate-limiting for LSA generation.
hold_interval
integer
The hold interval.
max_interval
integer
The max interval.
start_interval
integer
The start interval.
spf
dictionary
Set OSPF SPF timers.
initial_spf_delay
integer
Initial SPF schedule delay in milliseconds.
max_wait_time
integer
Maximum wait time between SPF calculations.
min_hold_time
integer
Minimum hold time between SPF calculations.
vrfs
list / elements=dictionary
Configure VRF specific OSPF settings.
areas
list / elements=dictionary
Configure properties of OSPF Areas.
area_id
string / required
The Area ID as an integer or IP Address.
authentication
dictionary
Authentication settings for the Area.
message_digest
boolean
    Choices:
  • no
  • yes
Use message-digest authentication.
set
boolean
    Choices:
  • no
  • yes
Set authentication for the area.
default_cost
integer
Specify the default cost for default summary LSA.
filter_list
list / elements=dictionary
Filter prefixes between OSPF areas.
direction
string / required
    Choices:
  • in
  • out
The direction to apply the route map.
route_map
string / required
The Route-map name.
nssa
dictionary
NSSA settings for the area.
default_information_originate
boolean
    Choices:
  • no
  • yes
Originate Type-7 default LSA into NSSA area.
no_redistribution
boolean
    Choices:
  • no
  • yes
Do not send redistributed LSAs into NSSA area.
no_summary
boolean
    Choices:
  • no
  • yes
Do not send summary LSAs into NSSA area.
set
boolean
    Choices:
  • no
  • yes
Configure area as NSSA.
translate
dictionary
Translate LSA.
type7
dictionary
Translate from Type 7 to Type 5.
always
boolean
    Choices:
  • no
  • yes
Always translate LSAs
never
boolean
    Choices:
  • no
  • yes
Never translate LSAs
supress_fa
boolean
    Choices:
  • no
  • yes
Suppress forwarding address in translated LSAs.
ranges
list / elements=dictionary
Configure an address range for the area.
cost
integer
Cost to use for the range.
not_advertise
boolean
    Choices:
  • no
  • yes
Suppress advertising the specified range.
prefix
string / required
IP in Prefix format (x.x.x.x/len)
stub
dictionary
Settings for configuring the area as a stub.
no_summary
boolean
    Choices:
  • no
  • yes
Prevent ABR from sending summary LSAs into stub area.
set
boolean
    Choices:
  • no
  • yes
Configure the area as a stub.
auto_cost
dictionary
Calculate OSPF cost according to bandwidth.
reference_bandwidth
integer / required
Reference bandwidth used to assign OSPF cost.
unit
string / required
    Choices:
  • Gbps
  • Mbps
Specify in which unit the reference bandwidth is specified.
bfd
boolean
    Choices:
  • no
  • yes
Enable BFD on all OSPF interfaces.
capability
dictionary
OSPF capability settings.
vrf_lite
dictionary
Enable VRF-lite capability settings.
evpn
boolean
    Choices:
  • no
  • yes
Ethernet VPN.
set
boolean
    Choices:
  • no
  • yes
Enable VRF-lite support.
default_information
dictionary
Control distribution of default routes.
originate
dictionary
Distribute a default route.
always
boolean
    Choices:
  • no
  • yes
Always advertise a default route.
route_map
string
Policy to control distribution of default routes
set
boolean
    Choices:
  • no
  • yes
Enable distribution of default route.
default_metric
integer
Specify default metric for redistributed routes.
distance
integer
Configure the OSPF administrative distance.
down_bit_ignore
boolean
    Choices:
  • no
  • yes
Configure a PE router to ignore the DN bit for network summary, external and NSSA external LSA.
graceful_restart
dictionary
Configure graceful restart.
grace_period
integer
Configure maximum interval to restart gracefully.
helper_disable
boolean
    Choices:
  • no
  • yes
Enable/Disable helper mode.
set
boolean
    Choices:
  • no
  • yes
Enable graceful-restart.
log_adjacency_changes
dictionary
Log changes in adjacency state.
detail
boolean
    Choices:
  • no
  • yes
Notify all state changes.
log
boolean
    Choices:
  • no
  • yes
Enable/disable logging changes in adjacency state.
max_lsa
dictionary
Feature to limit the number of non-self-originated LSAs.
ignore_count
integer
Set count on how many times adjacencies can be suppressed.
ignore_time
integer
Set time during which all adjacencies are suppressed.
max_non_self_generated_lsa
integer / required
Set the maximum number of non self-generated LSAs.
reset_time
integer
Set number of minutes after which ignore-count is reset to zero.
threshold
integer
Threshold value (%) at which to generate a warning message.
warning_only
boolean
    Choices:
  • no
  • yes
Log a warning message when limit is exceeded.
max_metric
dictionary
Maximize the cost metric.
router_lsa
dictionary
Router LSA configuration.
external_lsa
dictionary
External LSA configuration.
max_metric_value
integer
Set max metric value for external LSAs.
set
boolean
    Choices:
  • no
  • yes
Set external-lsa attribute.
include_stub
boolean
    Choices:
  • no
  • yes
Advertise Max metric for Stub links as well.
on_startup
dictionary
Effective only at startup.
set
boolean
    Choices:
  • no
  • yes
Set on-startup attribute.
wait_for_bgp_asn
integer
ASN of BGP to wait for.
wait_period
integer
Wait period in seconds after startup.
set
boolean
    Choices:
  • no
  • yes
Set router-lsa attribute.
summary_lsa
dictionary
Summary LSAs configuration.
max_metric_value
integer
Max metric value for summary LSAs.
set
boolean
    Choices:
  • no
  • yes
Set summary-lsa attribute.
maximum_paths
integer
Maximum paths per destination.
name_lookup
boolean
    Choices:
  • no
  • yes
Display OSPF router ids as DNS names.
passive_interface
dictionary
Suppress routing updates on the interface.
default
boolean
    Choices:
  • no
  • yes
Interfaces passive by default.
redistribute
list / elements=dictionary
Redistribute information from another routing protocol.
id
string
The identifier for the protocol specified.
protocol
string / required
    Choices:
  • bgp
  • direct
  • eigrp
  • isis
  • lisp
  • ospf
  • rip
  • static
The name of the protocol.
route_map
string / required
The route map policy to constrain redistribution.
rfc1583compatibility
boolean
    Choices:
  • no
  • yes
Configure 1583 compatibility for external path preferences.
router_id
string
Set OSPF process router-id.
shutdown
boolean
    Choices:
  • no
  • yes
Shutdown the OSPF protocol instance.
summary_address
list / elements=dictionary
Configure route summarization for redistribution.
not_advertise
boolean
    Choices:
  • no
  • yes
Supress advertising the specified summary.
prefix
string / required
IP prefix in format x.x.x.x/ml.
tag
integer
A 32-bit tag value.
table_map
dictionary
Policy for filtering/modifying OSPF routes before sending them to RIB.
filter
boolean
    Choices:
  • no
  • yes
Block the OSPF routes from being sent to RIB.
name
string / required
The Route Map name.
timers
dictionary
Configure timer related constants.
lsa_arrival
integer
Mimimum interval between arrival of a LSA.
lsa_group_pacing
integer
LSA group refresh/maxage interval.
throttle
dictionary
Configure throttle related constants.
lsa
dictionary
Set rate-limiting for LSA generation.
hold_interval
integer
The hold interval.
max_interval
integer
The max interval.
start_interval
integer
The start interval.
spf
dictionary
Set OSPF SPF timers.
initial_spf_delay
integer
Initial SPF schedule delay in milliseconds.
max_wait_time
integer
Maximum wait time between SPF calculations.
min_hold_time
integer
Minimum hold time between SPF calculations.
vrf
string / required
Name/Identifier of the VRF.
running_config
string
This option is used only with state parsed.
The value of this option should be the output received from the NX-OS device by executing the command show running-config | section "^router ospf .*".
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
state
string
    Choices:
  • merged
  • replaced
  • overridden
  • deleted
  • gathered
  • parsed
  • rendered
The state the configuration should be left in.

Notes

Note

  • Tested against NX-OS 7.0(3)I5(1).
  • This module works with connection network_cli and httpapi.

Examples

# Using merged

# Before state:
# -------------
# nxos-9k-rdo# sh running-config | section "^router ospf .*"
# nxos-9k-rdo#

- name: Merge the provided configuration with the exisiting running configuration
  cisco.nxos.nxos_ospfv2:
    config:
      processes:
      - process_id: 100
        router_id: 203.0.113.20
      - process_id: 102
        router_id: 198.51.100.1
        areas:
        - area_id: 0.0.0.100
          filter_list:
          - route_map: rmap_1
            direction: in
          - route_map: rmap_2
            direction: out
          ranges:
          - prefix: 198.51.100.64/27
            not_advertise: true
          - prefix: 198.51.100.96/27
            cost: 120
        - area_id: 0.0.0.101
          authentication:
            message_digest: true
        redistribute:
        - protocol: eigrp
          id: 120
          route_map: rmap_1
        - protocol: direct
          route_map: ospf102-direct-connect
        vrfs:
        - vrf: zone1
          router_id: 198.51.100.129
          redistribute:
          - protocol: static
            route_map: zone1-static-connect
          summary_address:
          - prefix: 198.51.100.128/27
            tag: 121
          - prefix: 198.51.100.160/27
          areas:
          - area_id: 0.0.0.102
            nssa:
              default_information_originate: true
              no_summary: true
          - area_id: 0.0.0.103
            nssa:
              no_summary: true
              translate:
                type7:
                  always: true
        - vrf: zone2
          auto_cost:
            reference_bandwidth: 45
            unit: Gbps
    state: merged

# Task output
# -------------
# before: {}
#
# commands:
#  - router ospf 102
#  - router-id 198.51.100.1
#  - redistribute eigrp 120 route-map rmap_1
#  - redistribute direct route-map ospf102-direct-connect
#  - area 0.0.0.100 filter-list route-map rmap_1 in
#  - area 0.0.0.100 filter-list route-map rmap_2 out
#  - area 0.0.0.100 range 198.51.100.64/27 not-advertise
#  - area 0.0.0.100 range 198.51.100.96/27 cost 120
#  - area 0.0.0.101 authentication message-digest
#  - vrf zone1
#  - router-id 198.51.100.129
#  - summary-address 198.51.100.128/27 tag 121
#  - summary-address 198.51.100.160/27
#  - redistribute static route-map zone1-static-connect
#  - area 0.0.0.102 nssa no-summary default-information-originate
#  - area 0.0.0.103 nssa no-summary
#  - area 0.0.0.103 nssa translate type7 always
#  - vrf zone2
#  - auto-cost reference-bandwidth 45 Gbps
#  - router ospf 100
#  - router-id 203.0.113.20
#
# after:
#    processes:
#    - process_id: "100"
#      router_id: 203.0.113.20
#    - areas:
#      - area_id: 0.0.0.100
#        filter_list:
#        - direction: out
#          route_map: rmap_2
#        - direction: in
#          route_map: rmap_1
#        ranges:
#        - not_advertise: true
#          prefix: 198.51.100.64/27
#        - cost: 120
#          prefix: 198.51.100.96/27
#      - area_id: 0.0.0.101
#        authentication:
#          message_digest: true
#      process_id: "102"
#      redistribute:
#      - protocol: direct
#        route_map: ospf102-direct-connect
#      - id: "120"
#        protocol: eigrp
#        route_map: rmap_1
#      router_id: 198.51.100.1
#      vrfs:
#      - areas:
#        - area_id: 0.0.0.102
#          nssa:
#            default_information_originate: true
#            no_summary: true
#        - area_id: 0.0.0.103
#          nssa:
#            no_summary: true
#            translate:
#              type7:
#                always: true
#        redistribute:
#        - protocol: static
#          route_map: zone1-static-connect
#        router_id: 198.51.100.129
#        vrf: zone1
#      - auto_cost:
#          reference_bandwidth: 45
#          unit: Gbps
#        vrf: zone2
#

# After state:
# ------------
# nxos-9k-rdo# sh running-config | section "^router ospf .*"
# router ospf 100
#   router-id 203.0.113.20
# router ospf 102
#   router-id 198.51.100.1
#   redistribute direct route-map ospf102-direct-connect
#   redistribute eigrp 120 route-map rmap_1
#   area 0.0.0.100 filter-list route-map rmap_2 out
#   area 0.0.0.100 filter-list route-map rmap_1 in
#   area 0.0.0.100 range 198.51.100.64/27 not-advertise
#   area 0.0.0.100 range 198.51.100.96/27 cost 120
#   area 0.0.0.101 authentication message-digest
#   vrf zone1
#     router-id 198.51.100.129
#     area 0.0.0.102 nssa no-summary default-information-originate
#     area 0.0.0.103 nssa no-summary
#     area 0.0.0.103 nssa translate type7 always
#     redistribute static route-map zone1-static-connect
#     summary-address 198.51.100.128/27 tag 121
#     summary-address 198.51.100.160/27
#   vrf zone2
#     auto-cost reference-bandwidth 45 Gbps

# Using replaced

# Before state:
# ------------
# nxos-9k-rdo# sh running-config | section "^router ospf .*"
# router ospf 100
#   router-id 203.0.113.20
# router ospf 102
#   router-id 198.51.100.1
#   redistribute direct route-map ospf102-direct-connect
#   redistribute eigrp 120 route-map rmap_1
#   area 0.0.0.100 filter-list route-map rmap_2 out
#   area 0.0.0.100 filter-list route-map rmap_1 in
#   area 0.0.0.100 range 198.51.100.64/27 not-advertise
#   area 0.0.0.100 range 198.51.100.96/27 cost 120
#   area 0.0.0.101 authentication message-digest
#   vrf zone1
#     router-id 198.51.100.129
#     area 0.0.0.102 nssa no-summary default-information-originate
#     area 0.0.0.103 nssa no-summary
#     area 0.0.0.103 nssa translate type7 always
#     redistribute static route-map zone1-static-connect
#     summary-address 198.51.100.128/27 tag 121
#     summary-address 198.51.100.160/27
#   vrf zone2
#     auto-cost reference-bandwidth 45 Gbps

- name: Replace device configurations of listed OSPF processes with provided configurations
  cisco.nxos.nxos_ospfv2:
    config:
      processes:
      - process_id: 102
        router_id: 198.51.100.1
        areas:
        - area_id: 0.0.0.100
          filter_list:
          - route_map: rmap_8
            direction: in
          ranges:
          - prefix: 198.51.100.64/27
            not_advertise: true
        - area_id: 0.0.0.101
          stub:
            no_summary: true
        redistribute:
        - protocol: eigrp
          id: 130
          route_map: rmap_1
        - protocol: direct
          route_map: ospf102-direct-connect
        vrfs:
        - vrf: zone1
          router_id: 198.51.100.129
          redistribute:
          - protocol: bgp
            id: 65563
            route_map: zone1-bgp-connect
          areas:
          - area_id: 0.0.0.102
            nssa:
              default_information_originate: true
              no_summary: true
    state: replaced

# Task output
# -------------
# before:
#    processes:
#    - process_id: "100"
#      router_id: 203.0.113.20
#    - areas:
#      - area_id: 0.0.0.100
#        filter_list:
#        - direction: out
#          route_map: rmap_2
#        - direction: in
#          route_map: rmap_1
#        ranges:
#        - not_advertise: true
#          prefix: 198.51.100.64/27
#        - cost: 120
#          prefix: 198.51.100.96/27
#      - area_id: 0.0.0.101
#        authentication:
#          message_digest: true
#      process_id: "102"
#      redistribute:
#      - protocol: direct
#        route_map: ospf102-direct-connect
#      - id: "120"
#        protocol: eigrp
#        route_map: rmap_1
#      router_id: 198.51.100.1
#      vrfs:
#      - areas:
#        - area_id: 0.0.0.102
#          nssa:
#            default_information_originate: true
#            no_summary: true
#        - area_id: 0.0.0.103
#          nssa:
#            no_summary: true
#            translate:
#              type7:
#                always: true
#        redistribute:
#        - protocol: static
#          route_map: zone1-static-connect
#        router_id: 198.51.100.129
#        vrf: zone1
#      - auto_cost:
#          reference_bandwidth: 45
#          unit: Gbps
#        vrf: zone2
#
#  commands:
#  - router ospf 102
#  - redistribute eigrp 130 route-map rmap_1
#  - no redistribute eigrp 120 route-map rmap_1
#  - area 0.0.0.100 filter-list route-map rmap_8 in
#  - no area 0.0.0.100 filter-list route-map rmap_2 out
#  - no area 0.0.0.100 range 198.51.100.96/27
#  - no area 0.0.0.101 authentication
#  - area 0.0.0.101 stub no-summary
#  - vrf zone1
#  - no summary-address 198.51.100.128/27 tag 121
#  - no summary-address 198.51.100.160/27
#  - redistribute bgp 65563 route-map zone1-bgp-connect
#  - no redistribute static route-map zone1-static-connect
#  - no area 0.0.0.103 nssa
#  - no area 0.0.0.103 nssa translate type7 always
#  - no vrf zone2
#
# after:
#    processes:
#    - process_id: "100"
#      router_id: 203.0.113.20
#    - areas:
#      - area_id: 0.0.0.101
#        stub:
#          no_summary: true
#      - area_id: 0.0.0.100
#        filter_list:
#        - direction: in
#          route_map: rmap_8
#        ranges:
#        - not_advertise: true
#          prefix: 198.51.100.64/27
#      process_id: "102"
#      redistribute:
#      - protocol: direct
#        route_map: ospf102-direct-connect
#      - id: "130"
#        protocol: eigrp
#        route_map: rmap_1
#      router_id: 198.51.100.1
#      vrfs:
#      - areas:
#        - area_id: 0.0.0.102
#          nssa:
#            default_information_originate: true
#            no_summary: true
#        redistribute:
#        - id: "65563"
#          protocol: bgp
#          route_map: zone1-bgp-connect
#        router_id: 198.51.100.129
#        vrf: zone1

# After state:
# ------------
# nxos-9k-rdo# sh running-config | section "^router ospf .*"
# router ospf 100
#   router-id 203.0.113.20
# router ospf 102
#   router-id 198.51.100.1
#   area 0.0.0.101 stub no-summary
#   redistribute direct route-map ospf102-direct-connect
#   redistribute eigrp 130 route-map rmap_1
#   area 0.0.0.100 filter-list route-map rmap_8 in
#   area 0.0.0.100 range 198.51.100.64/27 not-advertise
#   vrf zone1
#     router-id 198.51.100.129
#     area 0.0.0.102 nssa no-summary default-information-originate
#     redistribute bgp 65563 route-map zone1-bgp-connect

# Using overridden

# Before state:
# ------------
# nxos-9k-rdo# sh running-config | section "^router ospf .*"
# router ospf 100
#   router-id 203.0.113.20
# router ospf 102
#   router-id 198.51.100.1
#   redistribute direct route-map ospf102-direct-connect
#   redistribute eigrp 120 route-map rmap_1
#   area 0.0.0.100 filter-list route-map rmap_2 out
#   area 0.0.0.100 filter-list route-map rmap_1 in
#   area 0.0.0.100 range 198.51.100.64/27 not-advertise
#   area 0.0.0.100 range 198.51.100.96/27 cost 120
#   area 0.0.0.101 authentication message-digest
#   vrf zone1
#     router-id 198.51.100.129
#     area 0.0.0.102 nssa no-summary default-information-originate
#     area 0.0.0.103 nssa no-summary
#     area 0.0.0.103 nssa translate type7 always
#     redistribute static route-map zone1-static-connect
#     summary-address 198.51.100.128/27 tag 121
#     summary-address 198.51.100.160/27
#   vrf zone2
#     auto-cost reference-bandwidth 45 Gbps

- name: Overridde all OSPF configuration with provided configuration
  cisco.nxos.nxos_ospfv2:
    config:
      processes:
      - process_id: 104
        router_id: 203.0.113.20
      - process_id: 102
        router_id: 198.51.100.1
        shutdown: true
    state: overridden

# Task output
# -------------
# before:
#    processes:
#    - process_id: "100"
#      router_id: 203.0.113.20
#    - areas:
#      - area_id: 0.0.0.100
#        filter_list:
#        - direction: out
#          route_map: rmap_2
#        - direction: in
#          route_map: rmap_1
#        ranges:
#        - not_advertise: true
#          prefix: 198.51.100.64/27
#        - cost: 120
#          prefix: 198.51.100.96/27
#      - area_id: 0.0.0.101
#        authentication:
#          message_digest: true
#      process_id: "102"
#      redistribute:
#      - protocol: direct
#        route_map: ospf102-direct-connect
#      - id: "120"
#        protocol: eigrp
#        route_map: rmap_1
#      router_id: 198.51.100.1
#      vrfs:
#      - areas:
#        - area_id: 0.0.0.102
#          nssa:
#            default_information_originate: true
#            no_summary: true
#        - area_id: 0.0.0.103
#          nssa:
#            no_summary: true
#            translate:
#              type7:
#                always: true
#        redistribute:
#        - protocol: static
#          route_map: zone1-static-connect
#        router_id: 198.51.100.129
#        vrf: zone1
#      - auto_cost:
#          reference_bandwidth: 45
#          unit: Gbps
#        vrf: zone2
#
# commands:
#  - no router ospf 100
#  - router ospf 104
#  - router-id 203.0.113.20
#  - router ospf 102
#  - shutdown
#  - no redistribute direct route-map ospf102-direct-connect
#  - no redistribute eigrp 120 route-map rmap_1
#  - no area 0.0.0.100 filter-list route-map rmap_2 out
#  - no area 0.0.0.100 filter-list route-map rmap_1 in
#  - no area 0.0.0.100 range 198.51.100.64/27
#  - no area 0.0.0.100 range 198.51.100.96/27
#  - no area 0.0.0.101 authentication
#  - no vrf zone1
#  - no vrf zone2
#
# after:
#    processes:
#    - process_id: "102"
#      router_id: 198.51.100.1
#      shutdown: true
#    - process_id: "104"
#      router_id: 203.0.113.20

# After state:
# ------------
# nxos-9k-rdo# sh running-config | section "^router ospf .*"
# router ospf 102
#   router-id 198.51.100.1
#   shutdown
# router ospf 104
#   router-id 203.0.113.20

# Using deleted to delete a single OSPF process

# Before state:
# ------------
# nxos-9k-rdo# sh running-config | section "^router ospf .*"
# router ospf 100
#   router-id 203.0.113.20
# router ospf 102
#   router-id 198.51.100.1
#   redistribute direct route-map ospf102-direct-connect
#   redistribute eigrp 120 route-map rmap_1
#   area 0.0.0.100 filter-list route-map rmap_2 out
#   area 0.0.0.100 filter-list route-map rmap_1 in
#   area 0.0.0.100 range 198.51.100.64/27 not-advertise
#   area 0.0.0.100 range 198.51.100.96/27 cost 120
#   area 0.0.0.101 authentication message-digest
#   vrf zone1
#     router-id 198.51.100.129
#     area 0.0.0.102 nssa no-summary default-information-originate
#     area 0.0.0.103 nssa no-summary
#     area 0.0.0.103 nssa translate type7 always
#     redistribute static route-map zone1-static-connect
#     summary-address 198.51.100.128/27 tag 121
#     summary-address 198.51.100.160/27
#   vrf zone2
#     auto-cost reference-bandwidth 45 Gbps

- name: Delete a single OSPF process
  cisco.nxos.nxos_ospfv2:
    config:
      processes:
      - process_id: 102
    state: deleted

# Task output
# -------------
# before:
#    processes:
#    - process_id: "100"
#      router_id: 203.0.113.20
#    - areas:
#      - area_id: 0.0.0.100
#        filter_list:
#        - direction: out
#          route_map: rmap_2
#        - direction: in
#          route_map: rmap_1
#        ranges:
#        - not_advertise: true
#          prefix: 198.51.100.64/27
#        - cost: 120
#          prefix: 198.51.100.96/27
#      - area_id: 0.0.0.101
#        authentication:
#          message_digest: true
#      process_id: "102"
#      redistribute:
#      - protocol: direct
#        route_map: ospf102-direct-connect
#      - id: "120"
#        protocol: eigrp
#        route_map: rmap_1
#      router_id: 198.51.100.1
#      vrfs:
#      - areas:
#        - area_id: 0.0.0.102
#          nssa:
#            default_information_originate: true
#            no_summary: true
#        - area_id: 0.0.0.103
#          nssa:
#            no_summary: true
#            translate:
#              type7:
#                always: true
#        redistribute:
#        - protocol: static
#          route_map: zone1-static-connect
#        router_id: 198.51.100.129
#        vrf: zone1
#      - auto_cost:
#          reference_bandwidth: 45
#          unit: Gbps
#        vrf: zone2
#
# commands:
#  - no router ospf 102
#
# after:
#   processes:
#   - process_id: "100"
#     router_id: 203.0.113.20

# After state:
# ------------
# nxos-9k-rdo# sh running-config | section "^router ospf .*"
# router ospf 100
#   router-id 203.0.113.20

# Using deleted all OSPF processes from the device

# Before state:
# ------------
# nxos-9k-rdo# sh running-config | section "^router ospf .*"
# router ospf 100
#   router-id 203.0.113.20
# router ospf 102
#   router-id 198.51.100.1
#   redistribute direct route-map ospf102-direct-connect
#   redistribute eigrp 120 route-map rmap_1
#   area 0.0.0.100 filter-list route-map rmap_2 out
#   area 0.0.0.100 filter-list route-map rmap_1 in
#   area 0.0.0.100 range 198.51.100.64/27 not-advertise
#   area 0.0.0.100 range 198.51.100.96/27 cost 120
#   area 0.0.0.101 authentication message-digest
#   vrf zone1
#     router-id 198.51.100.129
#     area 0.0.0.102 nssa no-summary default-information-originate
#     area 0.0.0.103 nssa no-summary
#     area 0.0.0.103 nssa translate type7 always
#     redistribute static route-map zone1-static-connect
#     summary-address 198.51.100.128/27 tag 121
#     summary-address 198.51.100.160/27
#   vrf zone2
#     auto-cost reference-bandwidth 45 Gbps

- name: Delete all OSPF processes from the device
  cisco.nxos.nxos_ospfv2:
    state: deleted

# Task output
# -------------
# before:
#    processes:
#    - process_id: "100"
#      router_id: 203.0.113.20
#    - areas:
#      - area_id: 0.0.0.100
#        filter_list:
#        - direction: out
#          route_map: rmap_2
#        - direction: in
#          route_map: rmap_1
#        ranges:
#        - not_advertise: true
#          prefix: 198.51.100.64/27
#        - cost: 120
#          prefix: 198.51.100.96/27
#      - area_id: 0.0.0.101
#        authentication:
#          message_digest: true
#      process_id: "102"
#      redistribute:
#      - protocol: direct
#        route_map: ospf102-direct-connect
#      - id: "120"
#        protocol: eigrp
#        route_map: rmap_1
#      router_id: 198.51.100.1
#      vrfs:
#      - areas:
#        - area_id: 0.0.0.102
#          nssa:
#            default_information_originate: true
#            no_summary: true
#        - area_id: 0.0.0.103
#          nssa:
#            no_summary: true
#            translate:
#              type7:
#                always: true
#        redistribute:
#        - protocol: static
#          route_map: zone1-static-connect
#        router_id: 198.51.100.129
#        vrf: zone1
#      - auto_cost:
#          reference_bandwidth: 45
#          unit: Gbps
#        vrf: zone2
#
# commands:
#  - no router ospf 100
#  - no router ospf 102
#
#  after: {}

# After state:
# ------------
# nxos-9k-rdo# sh running-config | section "^router ospf .*"
# nxos-9k-rdo#

# Using rendered

- name: Render platform specific configuration lines (without connecting to the device)
  cisco.nxos.nxos_ospfv2:
    config:
      processes:
      - process_id: 100
        router_id: 203.0.113.20
      - process_id: 102
        router_id: 198.51.100.1
        areas:
        - area_id: 0.0.0.100
          filter_list:
          - route_map: rmap_1
            direction: in
          - route_map: rmap_2
            direction: out
          ranges:
          - prefix: 198.51.100.64/27
            not_advertise: true
          - prefix: 198.51.100.96/27
            cost: 120
        - area_id: 0.0.0.101
          authentication:
            message_digest: true
        redistribute:
        - protocol: eigrp
          id: 120
          route_map: rmap_1
        - protocol: direct
          route_map: ospf102-direct-connect
        vrfs:
        - vrf: zone1
          router_id: 198.51.100.129
          redistribute:
          - protocol: static
            route_map: zone1-static-connect
          summary_address:
          - prefix: 198.51.100.128/27
            tag: 121
          - prefix: 198.51.100.160/27
          areas:
          - area_id: 0.0.0.102
            nssa:
              default_information_originate: true
              no_summary: true
          - area_id: 0.0.0.103
            nssa:
              no_summary: true
              translate:
                type7:
                  always: true
        - vrf: zone2
          auto_cost:
            reference_bandwidth: 45
            unit: Gbps
    state: rendered

# Task Output (redacted)
# -----------------------
# rendered:
#  - router ospf 100
#  - router-id 203.0.113.20
#  - router ospf 102
#  - router-id 198.51.100.1
#  - redistribute eigrp 120 route-map rmap_1
#  - redistribute direct route-map ospf102-direct-connect
#  - area 0.0.0.100 filter-list route-map rmap_1 in
#  - area 0.0.0.100 filter-list route-map rmap_2 out
#  - area 0.0.0.100 range 198.51.100.64/27 not-advertise
#  - area 0.0.0.100 range 198.51.100.96/27 cost 120
#  - area 0.0.0.101 authentication message-digest
#  - vrf zone1
#  - router-id 198.51.100.129
#  - summary-address 198.51.100.128/27 tag 121
#  - summary-address 198.51.100.160/27
#  - redistribute static route-map zone1-static-connect
#  - area 0.0.0.102 nssa no-summary default-information-originate
#  - area 0.0.0.103 nssa no-summary
#  - area 0.0.0.103 nssa translate type7 always
#  - vrf zone2
#  - auto-cost reference-bandwidth 45 Gbps

# Using parsed

# parsed.cfg
# ------------
# router ospf 100
#   router-id 192.0.100.1
#   area 0.0.0.101 nssa no-summary no-redistribution
#   area 0.0.0.102 stub no-summary
#   redistribute direct route-map ospf-direct-connect
#   redistribute eigrp 120 route-map rmap_1
#   area 0.0.0.100 filter-list route-map rmap_2 out
#   area 0.0.0.100 filter-list route-map rmap_1 in
#   area 0.0.0.100 range 192.0.2.0/24 not-advertise
#   area 0.0.0.100 range 192.0.3.0/24 cost 120
#   area 0.0.0.100 authentication message-digest
#   vrf zone1
#     router-id 192.0.100.2
#     area 0.0.100.1 nssa no-summary no-redistribution
#     redistribute static route-map zone1-direct-connect
#     summary-address 10.0.0.0/24 tag 120
#     summary-address 11.0.0.0/24 not-advertise
#   vrf zone2
#     auto-cost reference-bandwidth 45 Gbps
#     down-bit-ignore
#     capability vrf-lite evpn
#     shutdown
# router ospf 102
#   router-id 198.54.100.1
#   shutdown
#   vrf zone2
#     summary-address 192.0.8.0/24 tag 120
#   vrf zone4
#     shutdown

- name: Parse externally provided OSPFv2 config
  cisco.nxos.nxos_ospfv2:
    running_config: "{{ lookup('file', 'ospfv2.cfg') }}"
    state: parsed

# Task output (redacted)
# -----------------------
# parsed:
#   processes:
#   - process_id: "100"
#     areas:
#       - area_id: 0.0.0.101
#         nssa:
#           no_redistribution: true
#           no_summary: true
#       - area_id: 0.0.0.102
#         stub:
#           no_summary: true
#       - area_id: 0.0.0.100
#         authentication:
#           message_digest: true
#         filter_list:
#           - direction: out
#             route_map: rmap_2
#           - direction: in
#             route_map: rmap_1
#         ranges:
#           - not_advertise: true
#             prefix: 192.0.2.0/24
#           - cost: 120
#             prefix: 192.0.3.0/24
#     redistribute:
#       - protocol: direct
#         route_map: ospf-direct-connect
#       - id: "120"
#         protocol: eigrp
#         route_map: rmap_1
#     router_id: 192.0.100.1
#     vrfs:
#       - vrf: zone1
#         areas:
#           - area_id: 0.0.100.1
#             nssa:
#               no_redistribution: true
#               no_summary: true
#         redistribute:
#           - protocol: static
#             route_map: zone1-direct-connect
#         router_id: 192.0.100.2
#         summary_address:
#           - prefix: 10.0.0.0/24
#             tag: 120
#           - not_advertise: true
#             prefix: 11.0.0.0/24
#       - vrf: zone2
#         auto_cost:
#           reference_bandwidth: 45
#           unit: Gbps
#         capability:
#           vrf_lite:
#             evpn: true
#         down_bit_ignore: true
#         shutdown: true
#   - process_id: "102"
#     router_id: 198.54.100.1
#     shutdown: true
#     vrfs:
#       - vrf: zone2
#         summary_address:
#           - prefix: 192.0.8.0/24
#             tag: 120
#       - vrf: zone4
#         shutdown: true

# Using gathered

- name: Gather OSPFv2 facts using gathered
  cisco.nxos.nxos_ospfv2:
    state: gathered

# Task output (redacted)
# -----------------------
#  gathered:
#    processes:
#      - process_id: "102"
#        areas:
#          - area_id: 0.0.0.101
#            stub:
#              no_summary: true
#          - area_id: 0.0.0.100
#            filter_list:
#              - direction: in
#                route_map: rmap_8
#            ranges:
#              - not_advertise: true
#                prefix: 198.51.100.64/27
#        redistribute:
#          - protocol: direct
#            route_map: ospf102-direct-connect
#          - id: "130"
#            protocol: eigrp
#            route_map: rmap_1
#        router_id: 198.51.100.1
#        vrfs:
#          - vrf: zone1
#            areas:
#              - area_id: 0.0.0.102
#                nssa:
#                  default_information_originate: true
#                  no_summary: true
#            redistribute:
#             - id: "65563"
#               protocol: bgp
#               route_map: zone1-bgp-connect
#            router_id: 198.51.100.129
#

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
after
dictionary
when changed
The resulting configuration model invocation.

Sample:
The configuration returned will always be in the same format of the parameters above.
before
dictionary
always
The configuration prior to the model invocation.

Sample:
The configuration returned will always be in the same format of the parameters above.
commands
list / elements=string
always
The set of commands pushed to the remote device.

Sample:
['router ospf 102', 'router-id 198.54.100.1', 'router ospf 100', 'router-id 192.0.100.1', 'redistribute eigrp 120 route-map rmap_1', 'redistribute direct route-map ospf-direct-connect', 'area 0.0.0.100 filter-list route-map rmap_1 in', 'area 0.0.0.100 filter-list route-map rmap_2 out', 'area 0.0.0.100 range 192.0.2.0/24 not-advertise', 'area 0.0.0.100 range 192.0.3.0/24 cost 120', 'vrf zone1', 'router-id 192.0.100.2', 'summary-address 10.0.0.0/24 tag 121', 'summary-address 11.0.0.0/24', 'redistribute static route-map zone1-direct-connect', 'vrf zone2', 'auto-cost reference-bandwidth 45 Gbps', 'capability vrf-lite evpn']


Authors

  • Nilashish Chakraborty (@NilashishC)

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/cisco/nxos/nxos_ospfv2_module.html