.. _vyos.rest.vyos_ospfv2_module: ********************* vyos.rest.vyos_ospfv2 ********************* **Manage OSPFv2 configuration on VyOS devices using REST API** Version added: 1.0.0 .. contents:: :local: :depth: 1 Synopsis -------- - Manages OSPFv2 configuration on VyOS devices via the REST API. - Uses REST API (``connection=httpapi``) instead of CLI. - In VyOS 1.5+, passive interfaces use per-interface config rather than passive-interface. Parameters ---------- .. raw:: html
Parameter Choices/Defaults Comments
config
dictionary
OSPFv2 configuration.
areas
list / elements=dictionary
OSPFv2 areas.
area_id
string / required
Area ID.
area_type
dictionary
Area type.
normal
boolean
    Choices:
  • no
  • yes
Normal area.
nssa
dictionary
NSSA area.
default_cost
integer
Default cost for NSSA.
no_summary
boolean
    Choices:
  • no
  • yes
Do not inject inter-area routes.
set
boolean
    Choices:
  • no
  • yes
Enable NSSA.
translate
string
    Choices:
  • always
  • candidate
  • never
NSSA-ABR translate setting.
stub
dictionary
Stub area.
default_cost
integer
Default cost for stub.
no_summary
boolean
    Choices:
  • no
  • yes
Do not inject inter-area routes.
set
boolean
    Choices:
  • no
  • yes
Enable stub.
authentication
string
    Choices:
  • plaintext-password
  • md5
Area authentication type.
network
list / elements=dictionary
Networks in this area.
address
string / required
Network address.
range
list / elements=dictionary
Area ranges.
address
string / required
Range address.
cost
integer
Cost for this range.
not_advertise
boolean
    Choices:
  • no
  • yes
Do not advertise this range.
substitute
string
Substitute prefix.
shortcut
string
    Choices:
  • default
  • disable
  • enable
Shortcut mode.
auto_cost
dictionary
Auto-cost reference bandwidth.
reference_bandwidth
integer
Reference bandwidth in Mbps.
default_information
dictionary
Default route distribution.
originate
dictionary
Originate default route.
always
boolean
    Choices:
  • no
  • yes
Always advertise default route.
metric
integer
Metric for default route.
metric_type
integer
Metric type.
route_map
string
Route map.
default_metric
integer
Default metric for redistributed routes.
distance
dictionary
Administrative distances.
global
integer
Global OSPFv2 distance.
ospf
dictionary
Per-route-type distances.
external
integer
External route distance.
inter_area
integer
Inter-area route distance.
intra_area
integer
Intra-area route distance.
log_adjacency_changes
string
    Choices:
  • detail
Log adjacency changes.
neighbor
list / elements=dictionary
OSPF neighbors.
neighbor_id
string / required
Neighbor IP.
poll_interval
integer
Poll interval.
priority
integer
Neighbor priority.
parameters
dictionary
OSPFv2 parameters.
abr_type
string
    Choices:
  • cisco
  • ibm
  • shortcut
  • standard
ABR type.
opaque_lsa
boolean
    Choices:
  • no
  • yes
Enable opaque LSA.
rfc1583_compatibility
boolean
    Choices:
  • no
  • yes
Enable RFC1583 compatibility.
router_id
string
Router ID.
passive_interface
list / elements=string
Passive interfaces (VyOS 1.5+: configured via protocols ospf interface <name> passive).
redistribute
list / elements=dictionary
Route redistribution.
metric
integer
Metric.
metric_type
integer
Metric type.
route_map
string
Route map.
route_type
string
    Choices:
  • bgp
  • connected
  • kernel
  • rip
  • static
Protocol to redistribute.
state
string
    Choices:
  • merged ←
  • replaced
  • deleted
  • gathered
Desired state.
merged adds/updates without removing existing config.
replaced replaces the entire OSPFv2 configuration.
deleted removes OSPFv2 configuration.
gathered returns current configuration as structured data.

Notes ----- .. note:: - Requires ``ansible_connection=httpapi`` with the VyOS httpapi plugin. - ``ansible_network_os`` must be set to ``vyos.rest.vyos``. - VyOS 1.5+ uses per-interface passive configuration rather than the global ``passive-interface`` command used in VyOS 1.4. Examples -------- .. code-block:: yaml - name: Merge OSPFv2 configuration vyos.rest.vyos_ospfv2: config: parameters: router_id: 192.0.1.1 abr_type: cisco auto_cost: reference_bandwidth: 2 areas: - area_id: "2" area_type: normal: true network: - address: 192.0.2.0/24 - area_id: "3" area_type: nssa: set: true - area_id: "4" area_type: stub: default_cost: 20 range: - address: 192.0.3.0/24 cost: 10 redistribute: - route_type: bgp metric: 10 passive_interface: - eth1 state: merged - name: Delete all OSPFv2 configuration vyos.rest.vyos_ospfv2: state: deleted - name: Gather current OSPFv2 configuration vyos.rest.vyos_ospfv2: state: gathered Return Values ------------- Common return values are documented `here `_, the following are the fields unique to this module: .. raw:: html
Key Returned Description
after
dictionary
when changed
OSPFv2 configuration after this module ran.

before
dictionary
always
OSPFv2 configuration before this module ran.

commands
list
always
List of API command tuples sent to the device.

gathered
dictionary
when state is gathered
Current OSPFv2 configuration as structured data.

response
dictionary
when changes are applied
Raw API response.

saved
boolean
when changes are applied
Whether the config was saved after changes.



Status ------ Authors ~~~~~~~ - VyOS Community (@vyos)