fortiswitch_router_ospf – OSPF configuration in Fortinet’s FortiSwitch

New in version 1.0.0.

Synopsis

  • This module is able to configure a FortiSwitch device 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 v7.0.0

Requirements

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

  • ansible>=2.11

FortiSW Version Compatibility


v7.0.0 v7.0.1 v7.0.2 v7.0.3
fortiswitch_router_ospf yes yes yes yes

Parameters

  • enable_log - Enable/Disable logging for task. type: bool required: false default: False
  • member_path - Member attribute path to operate on. type: str
  • member_state - Add or delete a member under specified attribute path. type: str choices: present, absent
  • router_ospf - OSPF configuration. type: dict
    • abr_type - Area border router type. type: str choices: cisco, ibm, shortcut, standard
    • area - OSPF area configuration. type: list member_path: area:id
      • default_cost - Summary default cost of stub or NSSA area. type: int
      • filter_list - OSPF area filter-list configuration. type: list member_path: area:id/filter_list:id
        • direction - Direction. type: str choices: in, out
        • id - Filter list entry ID. type: int required: true
        • list - Access-list or prefix-list name. Source router.access-list.name router.prefix-list.name. type: str
      • id - Area entry IP address. type: str required: true
      • nssa_translator_role - NSSA translator role type. type: str choices: candidate, never, always
      • range - OSPF area range configuration. type: list member_path: area:id/range:id
        • advertise - Enable/disable advertise status. type: str choices: disable, enable
        • id - Range entry ID. type: int required: true
        • prefix - Prefix. type: str
        • substitute - Substitute prefix. type: str
        • substitute_status - Enable/disable substitute status. type: str choices: enable, disable
      • shortcut - Enable/disable shortcut option. type: str choices: disable, enable, default
      • stub_type - Stub summary setting. type: str choices: no-summary, summary
      • type - Area type setting. type: str choices: regular, nssa, stub
      • virtual_link - OSPF virtual link configuration. type: list member_path: area:id/virtual_link:name
        • authentication - Authentication type. type: str choices: none, text, md5
        • authentication_key - Authentication key. type: str
        • dead_interval - Dead interval. type: int
        • hello_interval - Hello interval. type: int
        • md5_keys - OSPF md5 key configuration. Applicable only when authentication field is set to md5. type: list member_path: area:id/virtual_link:name/md5_keys:id
          • id - key-id (1-255). type: int required: true
          • key - md5-key. type: str
        • name - Virtual link entry name. type: str required: true
        • peer - Peer IP. type: str
        • retransmit_interval - Time between retransmitting lost link state advertisements. type: int
        • transmit_delay - Link state transmit delay. type: int
    • database_overflow - Enable/disable database overflow. type: str choices: enable, disable
    • database_overflow_max_external_lsa - Database overflow maximum External LSAs. type: int
    • database_overflow_time_to_recover - Database overflow time to recover (sec). type: int
    • default_information_metric - Default information metric. type: int
    • default_information_metric_type - Default information metric type. type: str choices: 1, 2
    • default_information_originate - Enable/disable generation of default route. type: str choices: enable, always, disable
    • distance - Administrative distance. type: int
    • distance_external - Administrative external route distance. type: int
    • distance_inter_area - Administrative inter-area route distance. type: int
    • distance_intra_area - Administrative intra-area route distance. type: int
    • distribute_list - Redistribute routes filter. type: list member_path: distribute_list:id
      • access_list - Access list name. Source router.access-list.name. type: str
      • id - Distribute list entry ID. type: int required: true
      • protocol - Protocol type. type: str choices: connected, static, rip, bgp, isis
    • interface - OSPF interface configuration. type: list member_path: interface:name
      • authentication - Authentication type. type: str choices: none, text, md5
      • authentication_key - Authentication key. type: str
      • bfd - Bidirectional Forwarding Detection (BFD). type: str choices: enable, disable
      • cost - Cost of the interface. type: int
      • dead_interval - Dead interval. For fast-hello assign value 1. type: int
      • hello_interval - Hello interval. type: int
      • hello_multiplier - Number of hello packets within dead interval.Valid only for fast-hello. type: int
      • md5_keys - OSPF md5 key configuration. Applicable only when authentication field is set to md5. type: list member_path: interface:name/md5_keys:id
        • id - key-id (1-255). type: int required: true
        • key - md5-key. type: str
      • mtu - Interface MTU. type: int
      • mtu_ignore - Disable MTU mismatch detection on this interface. type: str choices: enable, disable
      • name - Interface entry name. Source system.interface.name. type: str required: true
      • priority - Router priority. type: int
      • retransmit_interval - Time between retransmitting lost link state advertisements. type: int
      • transmit_delay - Link state transmit delay. type: int
      • ucast_ttl - Unicast TTL. type: int
    • log_neighbour_changes - Enable logging of OSPF neighbour"s changes type: str choices: enable, disable
    • name - Vrf name. type: str
    • network - Enable OSPF on an IP network. type: list member_path: network:id
      • area - Attach the network to area. type: str
      • id - Network entry ID. type: int required: true
      • prefix - Prefix. type: str
    • passive_interface - Passive interface configuration. type: list member_path: passive_interface:name
      • name - Passive interface name. Source system.interface.name. type: str required: true
    • redistribute - Redistribute configuration. type: list member_path: redistribute:name
      • metric - Redistribute metric setting. type: int
      • metric_type - Metric type. type: str choices: 1, 2
      • name - Redistribute name. type: str required: true
      • routemap - Route map name. Source router.route-map.name. type: str
      • status - status type: str choices: enable, disable
      • tag - Tag value. type: int
    • rfc1583_compatible - Enable/disable RFC1583 compatibility. type: str choices: enable, disable
    • router_id - Router ID. type: str
    • spf_timers - SPF calculation frequency. type: str
    • summary_address - Aggregate address for redistributed routes. type: list member_path: summary_address:id
      • id - Summary address entry ID. type: int required: true
      • prefix - Prefix. type: str
      • tag - Tag value. type: int
    • vrf - Enable OSPF on VRF. type: list member_path: vrf:name
      • abr_type - Area border router type. type: str choices: cisco, ibm, shortcut, standard
      • area - OSPF area configuration. type: list member_path: vrf:name/area:id
        • default_cost - Summary default cost of stub or NSSA area. type: int
        • filter_list - OSPF area filter-list configuration. type: list member_path: vrf:name/area:id/filter_list:id
          • direction - Direction. type: str choices: in, out
          • id - Filter list entry ID. type: int required: true
          • list - Access-list or prefix-list name. Source router.access-list.name router.prefix-list.name. type: str
        • id - Area entry IP address. type: str required: true
        • nssa_translator_role - NSSA translator role type. type: str choices: candidate, never, always
        • range - OSPF area range configuration. type: list member_path: vrf:name/area:id/range:id
          • advertise - Enable/disable advertise status. type: str choices: disable, enable
          • id - Range entry ID. type: int required: true
          • prefix - Prefix. type: str
          • substitute - Substitute prefix. type: str
          • substitute_status - Enable/disable substitute status. type: str choices: enable, disable
        • shortcut - Enable/disable shortcut option. type: str choices: disable, enable, default
        • stub_type - Stub summary setting. type: str choices: no-summary, summary
        • type - Area type setting. type: str choices: regular, nssa, stub
        • virtual_link - OSPF virtual link configuration. type: list member_path: vrf:name/area:id/virtual_link:name
          • authentication - Authentication type. type: str choices: none, text
          • authentication_key - Authentication key. type: str
          • dead_interval - Dead interval. type: int
          • hello_interval - Hello interval. type: int
          • name - Virtual link entry name. type: str required: true
          • peer - Peer IP. type: str
          • retransmit_interval - Time between retransmitting lost link state advertisements. type: int
          • transmit_delay - Link state transmit delay. type: int
      • database_overflow - Enable/disable database overflow. type: str choices: enable, disable
      • database_overflow_max_external_lsa - Database overflow maximum External LSAs. type: int
      • database_overflow_time_to_recover - Database overflow time to recover (sec). type: int
      • default_information_metric - Default information metric. type: int
      • default_information_metric_type - Default information metric type. type: str choices: 1, 2
      • default_information_originate - Enable/disable generation of default route. type: str choices: enable, always, disable
      • distance - Administrative distance. type: int
      • distance_external - Administrative external route distance. type: int
      • distance_inter_area - Administrative inter-area route distance. type: int
      • distance_intra_area - Administrative intra-area route distance. type: int
      • distribute_list - Redistribute routes filter. type: list member_path: vrf:name/distribute_list:id
        • access_list - Access list name. Source router.access-list.name. type: str
        • id - Distribute list entry ID. type: int required: true
        • protocol - Protocol type. type: str choices: connected, static, rip, bgp, isis
      • interface - OSPF interface configuration. type: list member_path: vrf:name/interface:name
        • authentication - Authentication type. type: str choices: none, text, md5
        • authentication_key - Authentication key. type: str
        • cost - Cost of the interface. type: int
        • dead_interval - Dead interval. For fast-hello assign value 1. type: int
        • hello_interval - Hello interval. type: int
        • hello_multiplier - Number of hello packets within dead interval.Valid only for fast-hello. type: int
        • md5_keys - OSPF md5 key configuration. Applicable only when authentication field is set to md5. type: list member_path: vrf:name/interface:name/md5_keys:id
          • id - key-id (1-255). type: int required: true
          • key - md5-key. type: str
        • mtu - Interface MTU. type: int
        • mtu_ignore - Disable MTU mismatch detection on this interface. type: str choices: enable, disable
        • name - Interface entry name. Source system.interface.name. type: str required: true
        • priority - Router priority. type: int
        • retransmit_interval - Time between retransmitting lost link state advertisements. type: int
        • transmit_delay - Link state transmit delay. type: int
        • ucast_ttl - Unicast TTL. type: int
      • log_neighbour_changes - Enable logging of OSPF neighbour"s changes type: str choices: enable, disable
      • name - Vrf name. Source router.vrf.name. type: str required: true
      • network - Enable OSPF on an IP network. type: list member_path: vrf:name/network:id
        • area - Attach the network to area. type: str
        • id - Network entry ID. type: int required: true
        • prefix - Prefix. type: str
      • passive_interface - Passive interface configuration. type: list member_path: vrf:name/passive_interface:name
        • name - Passive interface name. Source system.interface.name. type: str required: true
      • redistribute - Redistribute configuration. type: list member_path: vrf:name/redistribute:name
        • metric - Redistribute metric setting. type: int
        • metric_type - Metric type. type: str choices: 1, 2
        • name - Redistribute name. type: str required: true
        • routemap - Route map name. Source router.route-map.name. type: str
        • status - status type: str choices: enable, disable
        • tag - Tag value. type: int
      • rfc1583_compatible - Enable/disable RFC1583 compatibility. type: str choices: enable, disable
      • router_id - Router ID. type: str
      • spf_timers - SPF calculation frequency. type: str
      • summary_address - Aggregate address for redistributed routes. type: list member_path: vrf:name/summary_address:id
        • id - Summary address entry ID. type: int required: true
        • prefix - Prefix. type: str
        • tag - Tag value. type: int

Examples

- hosts: fortiswitch01
  collections:
    - fortinet.fortiswitch
  connection: httpapi
  vars:
   ansible_httpapi_use_ssl: yes
   ansible_httpapi_validate_certs: no
   ansible_httpapi_port: 443
  tasks:
  - name: OSPF configuration.
    fortiswitch_router_ospf:
      router_ospf:
        abr_type: "cisco"
        area:
         -
            default_cost: "5"
            filter_list:
             -
                direction: "in"
                id:  "8"
                list: "<your_own_value> (source router.access-list.name router.prefix-list.name)"
            id:  "10"
            nssa_translator_role: "candidate"
            range:
             -
                advertise: "disable"
                id:  "14"
                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: "24"
                hello_interval: "25"
                md5_keys:
                 -
                    id:  "27"
                    key: "<your_own_value>"
                name: "default_name_29"
                peer: "<your_own_value>"
                retransmit_interval: "31"
                transmit_delay: "32"
        database_overflow: "enable"
        database_overflow_max_external_lsa: "34"
        database_overflow_time_to_recover: "35"
        default_information_metric: "36"
        default_information_metric_type: "1"
        default_information_originate: "enable"
        distance: "39"
        distance_external: "40"
        distance_inter_area: "41"
        distance_intra_area: "42"
        distribute_list:
         -
            access_list: "<your_own_value> (source router.access-list.name)"
            id:  "45"
            protocol: "connected"
        interface:
         -
            authentication: "none"
            authentication_key: "<your_own_value>"
            bfd: "enable"
            cost: "51"
            dead_interval: "52"
            hello_interval: "53"
            hello_multiplier: "54"
            md5_keys:
             -
                id:  "56"
                key: "<your_own_value>"
            mtu: "58"
            mtu_ignore: "enable"
            name: "default_name_60 (source system.interface.name)"
            priority: "61"
            retransmit_interval: "62"
            transmit_delay: "63"
            ucast_ttl: "64"
        log_neighbour_changes: "enable"
        name: "default_name_66"
        network:
         -
            area: "<your_own_value>"
            id:  "69"
            prefix: "<your_own_value>"
        passive_interface:
         -
            name: "default_name_72 (source system.interface.name)"
        redistribute:
         -
            metric: "74"
            metric_type: "1"
            name: "default_name_76"
            routemap: "<your_own_value> (source router.route-map.name)"
            status: "enable"
            tag: "79"
        rfc1583_compatible: "enable"
        router_id: "<your_own_value>"
        spf_timers: "<your_own_value>"
        summary_address:
         -
            id:  "84"
            prefix: "<your_own_value>"
            tag: "86"
        vrf:
         -
            abr_type: "cisco"
            area:
             -
                default_cost: "90"
                filter_list:
                 -
                    direction: "in"
                    id:  "93"
                    list: "<your_own_value> (source router.access-list.name router.prefix-list.name)"
                id:  "95"
                nssa_translator_role: "candidate"
                range:
                 -
                    advertise: "disable"
                    id:  "99"
                    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: "109"
                    hello_interval: "110"
                    name: "default_name_111"
                    peer: "<your_own_value>"
                    retransmit_interval: "113"
                    transmit_delay: "114"
            database_overflow: "enable"
            database_overflow_max_external_lsa: "116"
            database_overflow_time_to_recover: "117"
            default_information_metric: "118"
            default_information_metric_type: "1"
            default_information_originate: "enable"
            distance: "121"
            distance_external: "122"
            distance_inter_area: "123"
            distance_intra_area: "124"
            distribute_list:
             -
                access_list: "<your_own_value> (source router.access-list.name)"
                id:  "127"
                protocol: "connected"
            interface:
             -
                authentication: "none"
                authentication_key: "<your_own_value>"
                cost: "132"
                dead_interval: "133"
                hello_interval: "134"
                hello_multiplier: "135"
                md5_keys:
                 -
                    id:  "137"
                    key: "<your_own_value>"
                mtu: "139"
                mtu_ignore: "enable"
                name: "default_name_141 (source system.interface.name)"
                priority: "142"
                retransmit_interval: "143"
                transmit_delay: "144"
                ucast_ttl: "145"
            log_neighbour_changes: "enable"
            name: "default_name_147 (source router.vrf.name)"
            network:
             -
                area: "<your_own_value>"
                id:  "150"
                prefix: "<your_own_value>"
            passive_interface:
             -
                name: "default_name_153 (source system.interface.name)"
            redistribute:
             -
                metric: "155"
                metric_type: "1"
                name: "default_name_157"
                routemap: "<your_own_value> (source router.route-map.name)"
                status: "enable"
                tag: "160"
            rfc1583_compatible: "enable"
            router_id: "<your_own_value>"
            spf_timers: "<your_own_value>"
            summary_address:
             -
                id:  "165"
                prefix: "<your_own_value>"
                tag: "167"

Return Values

Common return values are documented: https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values, the following are the fields unique to this module:

  • build - Build number of the fortiSwitch image returned: always type: str sample: 1547
  • http_method - Last method used to provision the content into FortiSwitch returned: always type: str sample: PUT
  • http_status - Last result given by FortiSwitch on last operation applied returned: always type: str sample: 200
  • mkey - Master key (id) used in the last call to FortiSwitch returned: success type: str sample: id
  • name - Name of the table used to fulfill the request returned: always type: str sample: urlfilter
  • path - Path of the table used to fulfill the request returned: always type: str sample: webfilter
  • serial - Serial number of the unit returned: always type: str sample: FS1D243Z13000122
  • status - Indication of the operation's result returned: always type: str sample: success
  • version - Version of the FortiSwitch returned: always type: str sample: v7.0.0

Status

  • This module is not guaranteed to have a backwards compatible interface.

Authors

  • Link Zheng (@chillancezen)
  • Jie Xue (@JieX19)
  • Hongbin Lu (@fgtdev-hblu)
  • Frank Shen (@frankshen01)
  • Miguel Angel Munoz (@mamunozgonzalez)

Hint

If you notice any issues in this documentation, you can create a pull request to improve it.