PARALLAX

eos_ospfv2

Configure OSPFv2 routing on Arista EOS devices

Collection: arista.eos

Full Name: arista.eos.eos_ospfv2

Controller module — runs on the local controller, not on remote hosts.

Synopsis

Configure OSPFv2 routing on Arista EOS devices

Parameters

NameTypeRequiredDefaultDescription
configdict
running_configstr
statestrmerged

Example

yaml
# Using merged

# Before state:
# -------------
# localhost#show running-config | section ospf
# localhost#

- name: Merge provided config into running config
  arista.eos.eos_ospfv2:
    config:
      - processes:
          - process_id: 1
            adjacency:
              exchange_start:
                threshold: 20045623
            areas:
              - filter:
                  address: "10.1.1.0/24"
                id: "0.0.0.2"
              - id: "0.0.0.50"
                range:
                  address: "172.20.0.0/16"
                  cost: 34
            default_information:
              metric: 100
              metric_type: 1
              originate: true
            distance:
              intra_area: 85
            max_lsa:
              count: 8000
              ignore_count: 3
              ignore_time: 6
              reset_time: 20
              threshold: 40
            networks:
              - area: "0.0.0.0"
                prefix: 10.10.2.0/24
              - area: "0.0.0.0"
                prefix: "10.10.3.0/24"
            redistribute:
              - routes: "static"
            router_id: "170.21.0.4"
          - process_id: 2
            vrf: "vrf01"
            areas:
              - id: "0.0.0.9"
                default_cost: 20
            max_lsa:
              count: 8000
              ignore_count: 3
              ignore_time: 6
              reset_time: 20
              threshold: 40
            networks:
              - area: "0.0.0.0"
                prefix: 10.10.2.0/24
              - area: "0.0.0.0"
                prefix: "10.10.3.0/24"
            redistribute:
              - routes: "static"
            router_id: "170.21.0.4"
          - process_id: 2
            vrf: "vrf01"
            areas:
              - id: "0.0.0.9"
                default_cost: 20
            max_lsa:
              count: 8000
              ignore_count: 3
              ignore_time: 6
              reset_time: 20
              threshold: 40
          - process_id: 3
            vrf: "vrf02"
            redistribute:
              - routes: "connected"

# Task output:
# ------------
#  before: {}

# commands
# - router ospf 1
# - adjacency exchange-start threshold 20045623
# - area 0.0.0.2 filter 10.1.1.0/24
# - area 0.0.0.50  range 172.20.0.0/16 cost 34
# - default-information originate metric 100 metric-type 1
# - distance ospf intra-area 85
# - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
# - network 10.10.2.0/24 area 0.0.0.0
# - network 10.10.3.0/24 area 0.0.0.0
# - redistribute static
# - router-id 170.21.0.4
# - exit
# - router ospf 2 vrf vrf01
# - area 0.0.0.9 default-cost 20
# - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
# - network 10.10.2.0/24 area 0.0.0.0
# - network 10.10.3.0/24 area 0.0.0.0
# - redistribute static
# - router-id 170.21.0.4
# - exit
# - router ospf 2 vrf vrf01
# - area 0.0.0.9 default-cost 20
# - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
# - exit
# - router ospf 3 vrf vrf02
# - redistribute connected
# - exit
#
# after:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02

# After state:
# ------------
# localhost#show running-config | section ospf
# router ospf 1
#    router-id 170.21.0.4
#    distance ospf intra-area 85
#    redistribute static
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50 range 172.20.0.0/16 cost 34
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
#    adjacency exchange-start threshold 20045623
#    default-information originate metric 100 metric-type 1
#
# router ospf 2 vrf vrf01
#    area 0.0.0.9 default-cost 20
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000

# Using replaced

# Before State:
# -------------
# localhost#show running-config | section ospf
# router ospf 1
#    router-id 170.21.0.4
#    distance ospf intra-area 85
#    redistribute static
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50 range 172.20.0.0/16 cost 34
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
#    adjacency exchange-start threshold 20045623
#    default-information originate metric 100 metric-type 1
# !
# router ospf 2 vrf vrf01
#    area 0.0.0.9 default-cost 20
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000
#
- name: replace Ospf configs
  arista.eos.eos_ospfv2:
    config:
      - processes:
          - process_id: 2
            vrf: "vrf01"
            point_to_point: true
            redistribute:
              - routes: "isis"
                isis_level: "level-1"
    state: replaced

# Task output:
# ------------
# before:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02
#
# commands:
# - router ospf 2 vrf vrf01
# - no area 0.0.0.9 default-cost 20
# - no max-lsa  8000 40 ignore-time 6  ignore-count 3  reset-time 20
# - point-to-point routes
# - redistribute isis level-1
#
# after:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - max_lsa:
#         count: 12000
#       process_id: 2
#       redistribute:
#       - isis_level: level-1
#         routes: isis
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02

# After state:
# ------------
# localhost#show running-config | section ospf
# router ospf 1
#    router-id 170.21.0.4
#    distance ospf intra-area 85
#    redistribute static
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50 range 172.20.0.0/16 cost 34
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
#    adjacency exchange-start threshold 20045623
#    default-information originate metric 100 metric-type 1
# !
# router ospf 2 vrf vrf01
#    redistribute isis level-1
#    max-lsa 12000
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000

# Using overridden

# Before state:
# -------------
# localhost#show running-config | section ospf
# router ospf 1
#    router-id 170.21.0.4
#    distance ospf intra-area 85
#    redistribute static
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50 range 172.20.0.0/16 cost 34
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
#    adjacency exchange-start threshold 20045623
#    default-information originate metric 100 metric-type 1
# !
# router ospf 2 vrf vrf01
#    redistribute isis level-1
#    max-lsa 12000
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000

- name: override running config with provided config
  arista.eos.eos_ospfv2:
    config:
      - processes:
          - process_id: 2
            vrf: "vrf01"
            redistribute:
              - routes: "connected"
    state: overriden

# Task output:
# ------------

# before:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - max_lsa:
#         count: 12000
#       process_id: 2
#       redistribute:
#       - isis_level: level-1
#         routes: isis
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02
#
# commands:
# - no router ospf 1
# - no router ospf 3
# - router ospf 2 vrf vrf01
# - no max-lsa  12000
# - no redistribute isis level-1
# - redistribute connected
#
# after:
#     processes:
#     - max_lsa:
#         count: 12000
#       process_id: 2
#       redistribute:
#       - isis_level: level-1
#         routes: isis
#       vrf: vrf01

# After state:
# ------------
# localhost#show running-config | section ospf
# router ospf 2 vrf vrf01
#    redistribute isis level-1
#    max-lsa 12000
# !

# Using deleted

# Before state:
# -------------
# localhost#show running-config | section ospf
# router ospf 1
#    router-id 170.21.0.4
#    distance ospf intra-area 85
#    redistribute static
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50 range 172.20.0.0/16 cost 34
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
#    adjacency exchange-start threshold 20045623
#    default-information originate metric 100 metric-type 1
# !
# router ospf 2 vrf vrf01
#    redistribute connected
#    area 0.0.0.9 default-cost 20
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000
#
- name: Delete OSPF config
  arista.eos.eos_ospfv2:
    config:
      processes:
        - process_id: 1
    state: deleted

# Task output:
# ------------
# before:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       redistribute:
#       - routes: connected
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02
#
# commands:
# - no router ospf 1
#
# after:
#     processes:
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       redistribute:
#       - routes: connected
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02

# After state:
# ------------
# localhost#show running-config | section ospf
# router ospf 2 vrf vrf01
#    redistribute connected
#    area 0.0.0.9 default-cost 20
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000

# Using gathered
# localhost#show running-config | section ospf
# router ospf 2 vrf vrf01
#    redistribute connected
#    area 0.0.0.9 default-cost 20
#    max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20
# !
# router ospf 3 vrf vrf02
#    redistribute connected
#    max-lsa 12000

- name: replace Ospf configs
  arista.eos.eos_ospfv2:
    state: gathered

# Task output:
# ------------
# gathered:
#     processes:
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 8000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       redistribute:
#       - routes: connected
#       vrf: vrf01
#     - max_lsa:
#         count: 12000
#       process_id: 3
#       redistribute:
#       - routes: connected
#       vrf: vrf02

# Using parsed
# ------------

# parsed.cfg
# router ospf 1
#    adjacency exchange-start threshold 20045623
#    area 0.0.0.2 filter 10.1.1.0/24
#    area 0.0.0.50  range 172.20.0.0/16 cost 34
#    default-information originate  metric 100 metric-type 1
#    distance ospf intra-area 85
#    max-lsa  80000 40 ignore-count 3  ignore-time 6  reset-time 20
#    network 10.10.2.0/24 area 0.0.0.0
#    network 10.10.3.0/24 area 0.0.0.0
#    redistribute static
#    router-id 170.21.0.4
# router ospf 2 vrf vrf01,
#    area 0.0.0.9 default-cost 20
#    max-lsa  80000 40 ignore-count 3  ignore-time 6  reset-time 20
# router ospf 3 vrf vrf02
#    redistribute static

- name: Parse running config and display structured facts
  arista.eos.eos_ospfv2:
    running_config: "{{ lookup('file', './parsed.cfg') }}"
    state: parsed

# Task output:
# ------------
# parsed:
#     processes:
#     - adjacency:
#         exchange_start:
#           threshold: 20045623
#       areas:
#       - area_id: 0.0.0.2
#         filter:
#           address: 10.1.1.0/24
#       - area_id: 0.0.0.50
#         range:
#           address: 172.20.0.0/16
#           cost: 34
#       default_information:
#         metric: 100
#         metric_type: 1
#         originate: true
#       distance:
#         intra_area: 85
#       max_lsa:
#         count: 80000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       networks:
#       - area: 0.0.0.0
#         prefix: 10.10.2.0/24
#       - area: 0.0.0.0
#         prefix: 10.10.3.0/24
#       process_id: 1
#       redistribute:
#       - routes: static
#       router_id: 170.21.0.4
#     - areas:
#       - area_id: 0.0.0.9
#         default_cost: 20
#       max_lsa:
#         count: 80000
#         ignore_count: 3
#         ignore_time: 6
#         reset_time: 20
#         threshold: 40
#       process_id: 2
#       vrf: vrf01,
#     - process_id: 3
#       redistribute:
#       - routes: static
#       vrf: vrf02

# Using rendered

- name: replace Ospf configs
  arista.eos.eos_ospfv2:
    config:
      processes:
        - process_id: 1
          adjacency:
            exchange_start:
              threshold: 20045623
          areas:
            - filter:
                address: "10.1.1.0/24"
              area_id: "0.0.0.2"
            - area_id: "0.0.0.50"
              range:
                address: "172.20.0.0/16"
                cost: 34
          default_information:
            metric: 100
            metric_type: 1
            originate: true
          distance:
            intra_area: 85
          max_lsa:
            count: 8000
            ignore_count: 3
            ignore_time: 6
            reset_time: 20
            threshold: 40
          networks:
            - area: "0.0.0.0"
              prefix: 10.10.2.0/24
            - area: "0.0.0.0"
              prefix: "10.10.3.0/24"
          redistribute:
            - routes: "static"
          router_id: "170.21.0.4"
        - process_id: 2
          vrf: "vrf01"
          areas:
            - area_id: "0.0.0.9"
              default_cost: 20
          max_lsa:
            count: 8000
            ignore_count: 3
            ignore_time: 6
            reset_time: 20
            threshold: 40
          networks:
            - area: "0.0.0.0"
              prefix: 10.10.2.0/24
            - area: "0.0.0.0"
              prefix: "10.10.3.0/24"
          redistribute:
            - routes: "static"
          router_id: "170.21.0.4"
        - process_id: 2
          vrf: "vrf01"
          areas:
            - area_id: "0.0.0.9"
              default_cost: 20
          max_lsa:
            count: 8000
            ignore_count: 3
            ignore_time: 6
            reset_time: 20
            threshold: 40
        - process_id: 3
          vrf: "vrf02"
          redistribute:
            - routes: "connected"
    state: rendered

# rendered:
#   - router ospf 1
#   - adjacency exchange-start threshold 20045623
#   - area 0.0.0.2 filter 10.1.1.0/24
#   - area 0.0.0.50  range 172.20.0.0/16 cost 34
#   - default-information originate metric 100 metric-type 1
#   - distance ospf intra-area 85
#   - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
#   - network 10.10.2.0/24 area 0.0.0.0
#   - network 10.10.3.0/24 area 0.0.0.0
#   - redistribute static
#   - router-id 170.21.0.4
#   - exit
#   - router ospf 2 vrf vrf01
#   - area 0.0.0.9 default-cost 20
#   - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
#   - network 10.10.2.0/24 area 0.0.0.0
#   - network 10.10.3.0/24 area 0.0.0.0
#   - redistribute static
#   - router-id 170.21.0.4
#   - exit
#   - router ospf 2 vrf vrf01
#   - area 0.0.0.9 default-cost 20
#   - max-lsa  8000 40 ignore-count 3  ignore-time 6  reset-time 20
#   - exit
#   - router ospf 3 vrf vrf02
#   - redistribute connected
#   - exit
Search
    ↑ ↓ move↵ openesc close