fortios_router_ospf – Configure OSPF in Fortinet’s FortiOS and FortiGate

New in version 2.8.

Synopsis

  • This module is able to configure a FortiGate or FortiOS by allowing the user to set and modify router feature and ospf category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.2

Requirements

The below requirements are needed on the host that executes this module.

  • fortiosapi>=0.9.8

Parameters

Parameter Choices/Defaults Comments
host
- / required
FortiOS or FortiGate ip address.
https
boolean
    Choices:
  • no
  • yes ←
Indicates if the requests towards FortiGate must use HTTPS protocol
password
-
Default:
""
FortiOS or FortiGate password.
router_ospf
-
Default:
null
Configure OSPF.
abr-type
-
    Choices:
  • cisco
  • ibm
  • shortcut
  • standard
Area border router type.
area
-
OSPF area configuration.
authentication
-
    Choices:
  • none
  • text
  • md5
Authentication type.
default-cost
-
Summary default cost of stub or NSSA area.
filter-list
-
OSPF area filter-list configuration.
direction
-
    Choices:
  • in
  • out
Direction.
id
- / required
Filter list entry ID.
list
-
Access-list or prefix-list name. Source router.access-list.name router.prefix-list.name.
id
- / required
Area entry IP address.
nssa-default-information-originate
-
    Choices:
  • enable
  • always
  • disable
Redistribute, advertise, or do not originate Type-7 default route into NSSA area.
nssa-default-information-originate-metric
-
OSPF default metric.
nssa-default-information-originate-metric-type
-
    Choices:
  • 1
  • 2
OSPF metric type for default routes.
nssa-redistribution
-
    Choices:
  • enable
  • disable
Enable/disable redistribute into NSSA area.
nssa-translator-role
-
    Choices:
  • candidate
  • never
  • always
NSSA translator role type.
range
-
OSPF area range configuration.
advertise
-
    Choices:
  • disable
  • enable
Enable/disable advertise status.
id
- / required
Range entry ID.
prefix
-
Prefix.
substitute
-
Substitute prefix.
substitute-status
-
    Choices:
  • enable
  • disable
Enable/disable substitute status.
shortcut
-
    Choices:
  • disable
  • enable
  • default
Enable/disable shortcut option.
stub-type
-
    Choices:
  • no-summary
  • summary
Stub summary setting.
type
-
    Choices:
  • regular
  • nssa
  • stub
Area type setting.
virtual-link
-
OSPF virtual link configuration.
authentication
-
    Choices:
  • none
  • text
  • md5
Authentication type.
authentication-key
-
Authentication key.
dead-interval
-
Dead interval.
hello-interval
-
Hello interval.
md5-key
-
MD5 key.
name
- / required
Virtual link entry name.
peer
-
Peer IP.
retransmit-interval
-
Retransmit interval.
transmit-delay
-
Transmit delay.
auto-cost-ref-bandwidth
-
Reference bandwidth in terms of megabits per second.
bfd
-
    Choices:
  • enable
  • disable
Bidirectional Forwarding Detection (BFD).
database-overflow
-
    Choices:
  • enable
  • disable
Enable/disable database overflow.
database-overflow-max-lsas
-
Database overflow maximum LSAs.
database-overflow-time-to-recover
-
Database overflow time to recover (sec).
default-information-metric
-
Default information metric.
default-information-metric-type
-
    Choices:
  • 1
  • 2
Default information metric type.
default-information-originate
-
    Choices:
  • enable
  • always
  • disable
Enable/disable generation of default route.
default-information-route-map
-
Default information route map. Source router.route-map.name.
default-metric
-
Default metric of redistribute routes.
distance
-
Distance of the route.
distance-external
-
Administrative external distance.
distance-inter-area
-
Administrative inter-area distance.
distance-intra-area
-
Administrative intra-area distance.
distribute-list
-
Distribute list configuration.
access-list
-
Access list name. Source router.access-list.name.
id
- / required
Distribute list entry ID.
protocol
-
    Choices:
  • connected
  • static
  • rip
Protocol type.
distribute-list-in
-
Filter incoming routes. Source router.access-list.name router.prefix-list.name.
distribute-route-map-in
-
Filter incoming external routes by route-map. Source router.route-map.name.
log-neighbour-changes
-
    Choices:
  • enable
  • disable
Enable logging of OSPF neighbour's changes
neighbor
-
OSPF neighbor configuration are used when OSPF runs on non-broadcast media
cost
-
Cost of the interface, value range from 0 to 65535, 0 means auto-cost.
id
- / required
Neighbor entry ID.
ip
-
Interface IP address of the neighbor.
poll-interval
-
Poll interval time in seconds.
priority
-
Priority.
network
-
OSPF network configuration.
area
-
Attach the network to area.
id
- / required
Network entry ID.
prefix
-
Prefix.
ospf-interface
-
OSPF interface configuration.
authentication
-
    Choices:
  • none
  • text
  • md5
Authentication type.
authentication-key
-
Authentication key.
bfd
-
    Choices:
  • global
  • enable
  • disable
Bidirectional Forwarding Detection (BFD).
cost
-
Cost of the interface, value range from 0 to 65535, 0 means auto-cost.
database-filter-out
-
    Choices:
  • enable
  • disable
Enable/disable control of flooding out LSAs.
dead-interval
-
Dead interval.
hello-interval
-
Hello interval.
hello-multiplier
-
Number of hello packets within dead interval.
interface
-
Configuration interface name. Source system.interface.name.
ip
-
IP address.
md5-key
-
MD5 key.
mtu
-
MTU for database description packets.
mtu-ignore
-
    Choices:
  • enable
  • disable
Enable/disable ignore MTU.
name
- / required
Interface entry name.
network-type
-
    Choices:
  • broadcast
  • non-broadcast
  • point-to-point
  • point-to-multipoint
  • point-to-multipoint-non-broadcast
Network type.
prefix-length
-
Prefix length.
priority
-
Priority.
resync-timeout
-
Graceful restart neighbor resynchronization timeout.
retransmit-interval
-
Retransmit interval.
status
-
    Choices:
  • disable
  • enable
Enable/disable status.
transmit-delay
-
Transmit delay.
passive-interface
-
Passive interface configuration.
name
- / required
Passive interface name. Source system.interface.name.
redistribute
-
Redistribute configuration.
metric
-
Redistribute metric setting.
metric-type
-
    Choices:
  • 1
  • 2
Metric type.
name
- / required
Redistribute name.
routemap
-
Route map name. Source router.route-map.name.
status
-
    Choices:
  • enable
  • disable
status
tag
-
Tag value.
restart-mode
-
    Choices:
  • none
  • lls
  • graceful-restart
OSPF restart mode (graceful or LLS).
restart-period
-
Graceful restart period.
rfc1583-compatible
-
    Choices:
  • enable
  • disable
Enable/disable RFC1583 compatibility.
router-id
-
Router ID.
spf-timers
-
SPF calculation frequency.
summary-address
-
IP address summary configuration.
advertise
-
    Choices:
  • disable
  • enable
Enable/disable advertise status.
id
- / required
Summary address entry ID.
prefix
-
Prefix.
tag
-
Tag value.
username
- / required
FortiOS or FortiGate username.
vdom
-
Default:
"root"
Virtual domain, among those defined previously. A vdom is a virtual instance of the FortiGate that can be configured and used as a different unit.

Notes

Note

  • Requires fortiosapi library developed by Fortinet

  • Run as a local_action in your playbook

Examples

- hosts: localhost
  vars:
   host: "192.168.122.40"
   username: "admin"
   password: ""
   vdom: "root"
  tasks:
  - name: Configure OSPF.
    fortios_router_ospf:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      https: "False"
      router_ospf:
        abr-type: "cisco"
        area:
         -
            authentication: "none"
            default-cost: "6"
            filter-list:
             -
                direction: "in"
                id:  "9"
                list: "<your_own_value> (source router.access-list.name router.prefix-list.name)"
            id:  "11"
            nssa-default-information-originate: "enable"
            nssa-default-information-originate-metric: "13"
            nssa-default-information-originate-metric-type: "1"
            nssa-redistribution: "enable"
            nssa-translator-role: "candidate"
            range:
             -
                advertise: "disable"
                id:  "19"
                prefix: "<your_own_value>"
                substitute: "<your_own_value>"
                substitute-status: "enable"
            shortcut: "disable"
            stub-type: "no-summary"
            type: "regular"
            virtual-link:
             -
                authentication: "none"
                authentication-key: "<your_own_value>"
                dead-interval: "29"
                hello-interval: "30"
                md5-key: "<your_own_value>"
                name: "default_name_32"
                peer: "<your_own_value>"
                retransmit-interval: "34"
                transmit-delay: "35"
        auto-cost-ref-bandwidth: "36"
        bfd: "enable"
        database-overflow: "enable"
        database-overflow-max-lsas: "39"
        database-overflow-time-to-recover: "40"
        default-information-metric: "41"
        default-information-metric-type: "1"
        default-information-originate: "enable"
        default-information-route-map: "<your_own_value> (source router.route-map.name)"
        default-metric: "45"
        distance: "46"
        distance-external: "47"
        distance-inter-area: "48"
        distance-intra-area: "49"
        distribute-list:
         -
            access-list: "<your_own_value> (source router.access-list.name)"
            id:  "52"
            protocol: "connected"
        distribute-list-in: "<your_own_value> (source router.access-list.name router.prefix-list.name)"
        distribute-route-map-in: "<your_own_value> (source router.route-map.name)"
        log-neighbour-changes: "enable"
        neighbor:
         -
            cost: "58"
            id:  "59"
            ip: "<your_own_value>"
            poll-interval: "61"
            priority: "62"
        network:
         -
            area: "<your_own_value>"
            id:  "65"
            prefix: "<your_own_value>"
        ospf-interface:
         -
            authentication: "none"
            authentication-key: "<your_own_value>"
            bfd: "global"
            cost: "71"
            database-filter-out: "enable"
            dead-interval: "73"
            hello-interval: "74"
            hello-multiplier: "75"
            interface: "<your_own_value> (source system.interface.name)"
            ip: "<your_own_value>"
            md5-key: "<your_own_value>"
            mtu: "79"
            mtu-ignore: "enable"
            name: "default_name_81"
            network-type: "broadcast"
            prefix-length: "83"
            priority: "84"
            resync-timeout: "85"
            retransmit-interval: "86"
            status: "disable"
            transmit-delay: "88"
        passive-interface:
         -
            name: "default_name_90 (source system.interface.name)"
        redistribute:
         -
            metric: "92"
            metric-type: "1"
            name: "default_name_94"
            routemap: "<your_own_value> (source router.route-map.name)"
            status: "enable"
            tag: "97"
        restart-mode: "none"
        restart-period: "99"
        rfc1583-compatible: "enable"
        router-id: "<your_own_value>"
        spf-timers: "<your_own_value>"
        summary-address:
         -
            advertise: "disable"
            id:  "105"
            prefix: "<your_own_value>"
            tag: "107"

Return Values

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

Key Returned Description
build
string
always
Build number of the fortigate image

Sample:
1547
http_method
string
always
Last method used to provision the content into FortiGate

Sample:
PUT
http_status
string
always
Last result given by FortiGate on last operation applied

Sample:
200
mkey
string
success
Master key (id) used in the last call to FortiGate

Sample:
id
name
string
always
Name of the table used to fulfill the request

Sample:
urlfilter
path
string
always
Path of the table used to fulfill the request

Sample:
webfilter
revision
string
always
Internal revision number

Sample:
17.0.2.10658
serial
string
always
Serial number of the unit

Sample:
FGVMEVYYQT3AB5352
status
string
always
Indication of the operation's result

Sample:
success
vdom
string
always
Virtual domain used

Sample:
root
version
string
always
Version of the FortiGate

Sample:
v5.6.3


Status

Authors

  • Miguel Angel Munoz (@mamunozgonzalez)

  • Nicolas Thomas (@thomnico)

Hint

If you notice any issues in this documentation you can edit this document to improve it.