fortinet.fortios.fortios_export_config_playbook – Collect the current configurations of the modules and convert then into playbooks.

Note

This plugin is part of the fortinet.fortios collection (version 2.1.3).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install fortinet.fortios.

To use it in a playbook, specify: fortinet.fortios.fortios_export_config_playbook.

New in version 2.11: of fortinet.fortios

Synopsis

  • Collect the current configurations of a module on a running device and convert the returned facts into a playbook that users can apply directly.

  • More than one playbook will be generated if there are many selectors provided.

Requirements

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

  • install galaxy collection fortinet.fortios >= 2.1.3.

Parameters

Parameter

Comments

access_token

string

Token-based authentication. Generated from GUI of Fortigate.

enable_log

boolean

Enable/Disable logging for task.

Choices:

  • no ← (default)

  • yes

filters

list / elements=string

A list of expressions to filter the returned results.

The items of the list are combined as LOGICAL AND with operator ampersand.

One item itself could be concatenated with a comma as LOGICAL OR.

formatters

list / elements=string

A list of fields to display for returned results.

params

dictionary

the parameter for each selector, see definition in above list.

selector

string / required

Module name that used to fetch the current configurations and export the playbook

Choices:

  • log_gui-display

  • system_fortiguard-service

  • router_route-map

  • system_sso-admin

  • wireless-controller_address

  • vpn.ssl_monitor

  • system.auto-update_status

  • system_cmdb

  • authentication_rule

  • log.fortianalyzer_override-setting

  • firewall.ssl_setting

  • vpn.ipsec_phase2-interface

  • router_key-chain

  • system_ddns

  • firewall_traffic-class

  • system_replacemsg-group

  • system_ftm-push

  • system_sms-server

  • firewall_central-snat-map

  • firewall_multicast-address6

  • vpn.status.ssl_hw-acceleration-status

  • system.replacemsg_sslvpn

  • ips_view-map

  • firewall_pfcp

  • system_pppoe-interface

  • webfilter_categories

  • firewall_addrgrp6

  • log.disk_filter

  • system.session-info_full-stat

  • firewall_proxy-address

  • emailfilter_block-allow-list

  • router_bgp

  • switch-controller_custom-command

  • system_resource-limits

  • system.replacemsg_auth

  • system.autoupdate_schedule

  • waf_sub-class

  • firewall_local-in-policy6

  • log.fortianalyzer2_override-setting

  • log.fortianalyzer_override-filter

  • system.replacemsg_icap

  • system_object-tagging

  • spamfilter_profile

  • switch-controller_remote-log

  • system.replacemsg_mms

  • switch-controller.security-policy_local-access

  • web-proxy_profile

  • log.fortianalyzer-cloud_override-filter

  • spamfilter_mheader

  • system_smc-ntp

  • user_adgrp

  • system_auto-script

  • switch-controller_quarantine

  • firewall.service_category

  • system_standalone-cluster

  • system_link-monitor

  • switch-controller_stp-settings

  • user_security-exempt-list

  • log.fortianalyzer-cloud_setting

  • switch-controller.qos_qos-policy

  • firewall_sniffer

  • wireless-controller_ssid-policy

  • wireless-controller_wag-profile

  • log.fortiguard_override-setting

  • system.replacemsg_mm7

  • system.replacemsg_mm4

  • firewall_internet-service

  • system.replacemsg_mm3

  • system.replacemsg_mm1

  • firewall.iprope.appctrl_status

  • firewall_vipgrp46

  • log.webtrends_filter

  • webfilter_ips-urlfilter-setting6

  • system_sso-forticloud-admin

  • gtp_apngrp

  • log_setting

  • firewall_address6-template

  • wireless-controller_scan

  • wireless-controller.hotspot20_h2qp-wan-metric

  • system_automation-action

  • system.autoupdate_tunneling

  • webfilter_ips-urlfilter-setting

  • pfcp_message-filter

  • switch-controller_network-monitor-settings

  • system_alias

  • switch-controller_mac-sync-settings

  • web-proxy_forward-server-group

  • system_session-helper

  • router_community-list

  • wireless-controller_qos-profile

  • firewall_dnstranslation

  • vpn.ssl.web_portal

  • system_vdom-property

  • system.replacemsg_device-detection-portal

  • log.syslogd2_setting

  • firewall_internet-service-custom-group

  • system.performance.firewall_statistics

  • firewall_profile-group

  • firewall.service_group

  • system.autoupdate_push-update

  • firewall_address6

  • endpoint-control_profile

  • wireless-controller_vap-status

  • wireless-controller_wids-profile

  • emailfilter_bword

  • log.fortiguard_filter

  • firewall_ipv6-eh-filter

  • switch-controller.ptp_settings

  • endpoint-control_fctems

  • user_device-category

  • firewall_identity-based-route

  • system.session-helper-info_list

  • system_console

  • firewall.iprope.appctrl_list

  • system_ntp

  • firewall_access-proxy-virtual-host

  • system_nat64

  • report_layout

  • wireless-controller_timers

  • wireless-controller.hotspot20_icon

  • log.memory_global-setting

  • router_multicast-flow

  • ssh-filter_profile

  • system_fortisandbox

  • system_dns64

  • system_virtual-wan-link

  • ips_sensor

  • firewall.wildcard-fqdn_custom

  • router_static

  • alertemail_setting

  • user_fortitoken

  • web-proxy_debug-url

  • vpn.ike_gateway

  • webfilter_override

  • switch-controller_nac-device

  • system_fsso-polling

  • user_peer

  • vpn.ssl.web_host-check-software

  • gtp_message-filter-v0v1

  • switch-controller_lldp-profile

  • switch-controller_dynamic-port-policy

  • system.replacemsg_nac-quar

  • system_stp

  • user_nac-policy

  • wireless-controller_snmp

  • emailfilter_fortishield

  • switch-controller.security-policy_captive-portal

  • firewall_shaping-policy

  • wireless-controller_wlchanlistlic

  • log_custom-field

  • switch-controller_mac-policy

  • firewall_address

  • certificate_crl

  • firewall.ssh_setting

  • vpn.ssl.web_realm

  • switch-controller.auto-config_policy

  • router_access-list

  • system_nd-proxy

  • log.memory_setting

  • system_alarm

  • system_ipv6-neighbor-cache

  • wireless-controller_log

  • extender_lte-carrier-by-mcc-mnc

  • webfilter_ftgd-statistics

  • hardware.npu.np6_ipsec-stats

  • firewall_vendor-mac-summary

  • system_cluster-sync

  • wanopt_settings

  • emailfilter_dnsbl

  • endpoint-control_registered-forticlient

  • system_dedicated-mgmt

  • file-filter_profile

  • log.fortianalyzer-cloud_override-setting

  • firewall_policy46

  • system.source-ip_status

  • system_modem

  • router_static6

  • firewall_decrypted-traffic-mirror

  • antivirus_settings

  • switch-controller_storm-control-policy

  • switch-controller_802-1X-settings

  • system_session-ttl

  • system_storage

  • system_isf-queue-profile

  • log.memory_filter

  • firewall_auth-portal

  • antivirus_notification

  • user_ldap

  • ips_global

  • wanopt_remote-storage

  • system_speed-test-schedule

  • wireless-controller.hotspot20_qos-map

  • system.session-info_ttl

  • vpn_l2tp

  • monitoring_np6-ipsec-engine

  • system_npu

  • firewall_vip46

  • authentication_setting

  • vpn.certificate_ocsp-server

  • antivirus_heuristic

  • spamfilter_bword

  • system_custom-language

  • web-proxy_explicit

  • log.syslogd3_override-setting

  • wireless-controller_wtp-group

  • system_vdom-sflow

  • switch-controller_igmp-snooping

  • waf_signature

  • log.null-device_setting

  • ips_rule-settings

  • log.syslogd_setting

  • system.session-info_expectation

  • switch-controller.security-policy_802-1X

  • system_np6

  • report_setting

  • gtp_tunnel-limit

  • user_setting

  • icap_profile

  • system_geoip-override

  • vpn.ipsec_phase1

  • vpn.ipsec_phase2

  • wireless-controller.hotspot20_anqp-network-auth-type

  • webfilter_ips-urlfilter-cache-setting

  • firewall.ipmacbinding_setting

  • log.fortianalyzer2_filter

  • system.ip-conflict_status

  • application_rule-settings

  • switch-controller_flow-tracking

  • log.syslogd4_filter

  • system_speed-test-server

  • firewall_acl

  • system_proxy-arp

  • webfilter_ftgd-local-rating

  • switch-controller_snmp-user

  • nsxt_setting

  • ips_custom

  • switch-controller_switch-interface-tag

  • router_policy6

  • switch-controller.qos_ip-dscp-map

  • log_eventfilter

  • firewall_internet-service-custom

  • switch-controller_traffic-sniffer

  • router_auth-path

  • firewall_internet-service-ipbl-reason

  • system_external-resource

  • firewall_security-policy

  • user_exchange

  • sctp-filter_profile

  • system_ips-urlfilter-dns6

  • vpn.ipsec.tunnel_details

  • report_style

  • log.syslogd2_override-filter

  • wireless-controller_wtp

  • wireless-controller_rf-analysis

  • system_ipip-tunnel

  • system_saml

  • system.dhcp6_server

  • emailfilter_profile

  • hardware.npu.np6_sse-stats

  • log.fortianalyzer3_override-filter

  • hardware_status

  • firewall_multicast-policy

  • vpn_ocvpn

  • spamfilter_bwl

  • switch-controller_fortilink-settings

  • firewall_proute6

  • system_arp

  • firewall_internet-service-addition

  • webfilter_status

  • system_ips

  • emailfilter_bwl

  • system_password-policy

  • wireless-controller_mpsk-profile

  • switch-controller_virtual-port-pool

  • wireless-controller_setting

  • system.3g-modem_custom

  • wireless-controller.hotspot20_anqp-ip-address-type

  • firewall_vipgrp

  • switch-controller_switch-profile

  • vpn.ipsec.stats_tunnel

  • system_switch-interface

  • router_isis

  • firewall_policy

  • log.syslogd_override-setting

  • system_lte-modem

  • firewall_access-proxy

  • router_info

  • system.performance.firewall_packet-distribution

  • webfilter_content

  • firewall_vipgrp6

  • emailfilter_mheader

  • firewall.shaper_traffic

  • firewall.schedule_onetime

  • antivirus_profile

  • gtp_ie-allow-list

  • log.fortianalyzer_setting

  • videofilter_youtube-key

  • vpn.ipsec.tunnel_name

  • firewall_ippool6

  • wireless-controller_status

  • system_central-management

  • system.replacemsg_http

  • vpn.status.ssl_list

  • vpn.ipsec.tunnel_summary

  • hardware.npu.np6_session-stats

  • cifs_domain-controller

  • system_zone

  • system_vdom-dns

  • firewall_multicast-address

  • wireless-controller_wtp-profile

  • vpn.ssl_settings

  • router_ospf

  • switch-controller.qos_queue-policy

  • dpdk_cpus

  • endpoint-control_forticlient-ems

  • ftp-proxy_explicit

  • hardware.npu.np6_port-list

  • user_device-group

  • vpn.certificate_crl

  • system.replacemsg_admin

  • wireless-controller_wtp-status

  • webfilter_profile

  • switch-controller_storm-control

  • firewall_ssl-ssh-profile

  • vpn.ssl_client

  • gtp_ie-white-list

  • firewall_city

  • user_certificate

  • log.disk_setting

  • nsxt_service-chain

  • dlp_filepattern

  • firewall_acl6

  • firewall_ippool

  • web-proxy_url-match

  • dlp_fp-sensitivity

  • system_interface

  • log.syslogd3_override-filter

  • router_bfd

  • system_fortimanager

  • firewall_internet-service-extension

  • system.replacemsg_webproxy

  • user_password-policy

  • wireless-controller_inter-controller

  • certificate_remote

  • log.syslogd4_setting

  • firewall_internet-service-owner

  • hardware_cpu

  • switch-controller_switch-group

  • user_fsso

  • firewall_vipgrp64

  • user_quarantine

  • system_ips-urlfilter-dns

  • wireless-controller_addrgrp

  • system_fm

  • wireless-controller_apcfg-profile

  • system_global

  • vpn.ipsec.stats_crypto

  • wireless-controller.hotspot20_anqp-nai-realm

  • hardware_memory

  • system_physical-switch

  • system_affinity-packet-redistribution

  • system_status

  • firewall_gtp

  • firewall_internet-service-reputation

  • firewall_proute

  • videofilter_profile

  • log.fortianalyzer3_setting

  • system.auto-update_versions

  • firewall_vip

  • system_virtual-switch

  • firewall_mms-profile

  • wanopt_auth-group

  • wanopt_webcache

  • system.snmp_user

  • firewall_ip-translation

  • system_settings

  • log.fortianalyzer2_setting

  • wireless-controller_vap

  • ipsec_tunnel

  • wanopt_cache-service

  • log.syslogd4_override-filter

  • switch-controller_switch-log

  • firewall_internet-service-group

  • system.replacemsg_mail

  • extender_modem-status

  • system_replacemsg-image

  • system.performance_status

  • system_acme

  • antivirus_quarantine

  • switch-controller.initial-config_template

  • log.fortianalyzer2_override-filter

  • system.session-info_list

  • vpn.certificate_ca

  • endpoint-control_forticlient-registration-sync

  • system_sdn-connector

  • vpn.ssl.web_user-group-bookmark

  • system_fortiguard-log-service

  • endpoint-control_settings

  • system_central-mgmt

  • hardware_nic

  • log.null-device_filter

  • gtp_message-filter-v2

  • dlp_settings

  • wireless-controller_utm-profile

  • router_rip

  • router_aspath-list

  • firewall.schedule_group

  • firewall_internet-service-list

  • system_dscp-based-priority

  • dlp_sensitivity

  • icap_server

  • vpn.ipsec_phase1-interface

  • authentication_scheme

  • router_prefix-list6

  • system_sdwan

  • log.fortianalyzer3_filter

  • system_email-server

  • dlp_sensor

  • application_list

  • firewall_internet-service-append

  • vpn.ssl.web_user-bookmark

  • firewall.shaper_traffic-shaper

  • system_management-tunnel

  • system_csf

  • firewall.shaper_per-ip-shaper

  • switch-controller.ptp_policy

  • switch-controller_stp-instance

  • mgmt-data_status

  • dnsfilter_profile

  • user_device-access-list

  • system_ha-monitor

  • monitoring_npu-hpe

  • wireless-controller.hotspot20_anqp-venue-name

  • system.snmp_sysinfo

  • system_fortiai

  • system_session

  • application_custom

  • ips_session

  • system_api-user

  • system.info.admin_ssh

  • ips_rule

  • spamfilter_fortishield

  • log.fortianalyzer-cloud_filter

  • system_netflow

  • vpn.ipsec_forticlient

  • system_automation-trigger

  • firewall_policy64

  • wireless-controller.hotspot20_h2qp-osu-provider

  • application_name

  • wireless-controller_access-control-list

  • firewall.service_custom

  • spamfilter_iptrust

  • firewall_internet-service-botnet

  • firewall_internet-service-definition

  • gtp_rat-timeout-profile

  • system_mobile-tunnel

  • wireless-controller_nac-profile

  • user_saml

  • firewall_ttl-policy

  • wireless-controller_client-info

  • system_vne-tunnel

  • system.replacemsg_utm

  • gtp_apn

  • vpn_pptp

  • wireless-controller.hotspot20_hs-profile

  • log.webtrends_setting

  • firewall_local-in-policy

  • extender-controller_dataplan

  • system_gi-gk

  • wireless-controller_region

  • router_policy

  • switch-controller_port-policy

  • switch-controller.qos_dot1p-map

  • firewall_multicast-policy6

  • switch-controller.initial-config_vlans

  • system_federated-upgrade

  • wanopt_content-delivery-network-rule

  • firewall_region

  • system_dns-database

  • waf_main-class

  • firewall_policy6

  • system_vdom-radius-server

  • system_vdom

  • user_tacacs+

  • wanopt_peer

  • log.syslogd3_setting

  • report_dataset

  • webfilter_ftgd-local-cat

  • router_multicast6

  • vpn.certificate_remote

  • extender_lte-carrier-list

  • system_fips-cc

  • switch-controller_snmp-community

  • system_geneve

  • system_ha

  • log.syslogd3_filter

  • user_radius

  • firewall_DoS-policy6

  • switch-controller.auto-config_default

  • system_tos-based-priority

  • vpn.certificate_local

  • system_accprofile

  • vpn.status_pptp

  • wireless-controller_global

  • log.syslogd_filter

  • vpn.status_l2tp

  • system_ipsec-aggregate

  • wireless-controller_ap-status

  • switch-controller_poe

  • log.syslogd2_filter

  • wireless-controller_ble-profile

  • system_password-policy-guest-admin

  • user_pop3

  • switch-controller_vlan-policy

  • system_geoip-country

  • switch-controller_system

  • videofilter_youtube-channel-filter

  • voip_profile

  • vpn.ipsec_manualkey-interface

  • emailfilter_options

  • system.info.admin_status

  • switch-controller_snmp-sysinfo

  • firewall_internet-service-sld

  • system_vdom-netflow

  • firewall.ipmacbinding_table

  • system_automation-destination

  • dlp_fp-doc-source

  • firewall_ldb-monitor

  • firewall.ssh_host-key

  • system_vdom-link

  • system_admin

  • system_fortianalyzer-connectivity

  • router_ospf6

  • user_device

  • log.fortiguard_setting

  • system.snmp_community

  • wireless-controller_arrp-profile

  • ips_settings

  • log.syslogd_override-filter

  • system_vdom-exception

  • system_wccp

  • antivirus_mms-checksum

  • router_info6

  • system_ha-nonsync-csum

  • system_automation-stitch

  • system_mem-mgr

  • firewall_profile-protocol-options

  • report_theme

  • firewall.ssh_local-key

  • system_mgmt-csum

  • system.performance_top

  • firewall_vip64

  • web-proxy_wisp

  • spamfilter_options

  • system.checksum_status

  • system_dns-server

  • system.replacemsg_alertmail

  • log.fortiguard_override-filter

  • endpoint-control_client

  • firewall_access-proxy-ssh-client-cert

  • system_fortiguard

  • web-proxy_global

  • wanopt_profile

  • switch-controller_traffic-policy

  • wireless-controller.hotspot20_anqp-3gpp-cellular

  • system.replacemsg_ec

  • switch-controller_vlan

  • system_vxlan

  • switch-controller_snmp-trap-threshold

  • webfilter_search-engine

  • system_ipv6-tunnel

  • certificate_local

  • system.lldp_network-policy

  • user_fsso-polling

  • system.dhcp_server

  • report_chart

  • vpn.certificate_setting

  • router_bfd6

  • system.replacemsg_nntp

  • system.session-info_statistics

  • firewall_proxy-policy

  • system_dns

  • user_peergrp

  • vpn.ipsec_concentrator

  • webfilter_override-usr

  • ips_decoder

  • dnsfilter_domain-filter

  • report.sql_status

  • switch-controller.auto-config_custom

  • wireless-controller_vap-group

  • emailfilter_iptrust

  • system_startup-error-log

  • firewall_internet-service-name

  • system_affinity-interrupt

  • firewall_shaping-profile

  • log.syslogd4_override-setting

  • firewall_interface-policy6

  • vpn.ipsec_manualkey

  • firewall.shaper_per-ip

  • firewall_vendor-mac

  • switch-controller_global

  • router_setting

  • user_local

  • firewall.schedule_recurring

  • system_sit-tunnel

  • system_arp-table

  • firewall_carrier-endpoint-bwl

  • switch-controller_lldp-settings

  • webfilter_content-header

  • system_auto-install

  • log.fortianalyzer3_override-setting

  • user_domain-controller

  • router_multicast

  • firewall_ssl-server

  • system.replacemsg_traffic-quota

  • system_virtual-wire-pair

  • system_mac-address-table

  • system.replacemsg_automation

  • log.fortianalyzer_filter

  • system_network-visibility

  • firewall_internet-service-ipbl-vendor

  • switch-controller_nac-settings

  • firewall_interface-policy

  • extender_extender-info

  • system.replacemsg_fortiguard-wf

  • wireless-controller_bonjour-profile

  • gtp_apn-shaper

  • webfilter_urlfilter

  • wireless-controller_spectral-info

  • credential-store_domain-controller

  • hardware.npu.np6_synproxy-stats

  • system_probe-response

  • wireless-controller.hotspot20_h2qp-operator-name

  • switch-controller_sflow

  • cifs_profile

  • webfilter_fortiguard

  • extender_sys-info

  • wireless-controller.hotspot20_anqp-roaming-consortium

  • firewall_DoS-policy

  • firewall_proxy-addrgrp

  • firewall_addrgrp

  • system_sflow

  • router_ripng

  • firewall_vip6

  • web-proxy_forward-server

  • system.replacemsg_spam

  • certificate_ca

  • firewall_country

  • firewall.ssh_local-ca

  • spamfilter_dnsbl

  • firewall_access-proxy6

  • switch-controller_location

  • firewall.consolidated_policy

  • router_access-list6

  • system_session6

  • hardware.npu.np6_dce

  • waf_profile

  • firewall.wildcard-fqdn_group

  • switch-controller_managed-switch

  • user_group

  • log.syslogd2_override-setting

  • user_krb-keytab

  • firewall.iprope_list

  • system_ptp

  • dpdk_global

  • application_group

  • system.replacemsg_ftp

  • log_threat-weight

  • extender-controller_extender

  • wireless-controller.hotspot20_h2qp-conn-capability

  • router_prefix-list

  • system_gre-tunnel

  • system_ike

selectors

list / elements=string

A list of selectors. the module will use selectors if parameter selector not specified.

sorters

list / elements=string

A list of expressions to sort the returned results.

The items of the list are in ascending order with operator ampersand.

One item itself could be in decending order with a comma inside.

vdom

string

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.

Default: “root”

Notes

Note

  • Different selector may have different parameters, users are expected to look up them for a specific selector.

  • For some selectors, the objects are global, no params are allowed to appear.

  • If params is empty a non-unique object, the whole object list is returned.

  • This module has support for all configuration API, excluding any monitor API.

  • The result of API request is stored in results as a list.

Examples

- hosts: fortigateslab
  connection: httpapi
  collections:
    - fortinet.fortios
  vars:
    ansible_httpapi_use_ssl: yes
    ansible_httpapi_validate_certs: no
    ansible_httpapi_port: 443
    vdom: "root"
  tasks:
  - name: Will generate the playbooks for each selector/module.
    fortios_export_config_playbook:
      selectors:
      - selector: firewall_address
        params:
          name: "gmail.com"
      - selector: system.snmp_user
        params:
          name: "snmp_user_test"
      output_path: "./"

Return Values

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

Key

Description

build

string

Build number of the fortigate image

Returned: always

Sample: “1547”

http_method

string

Last method used to provision the content into FortiGate

Returned: always

Sample: “GET”

name

string

Name of the table used to fulfill the request

Returned: always

Sample: “firmware”

path

string

Path of the table used to fulfill the request

Returned: always

Sample: “system”

revision

string

Internal revision number

Returned: always

Sample: “17.0.2.10658”

serial

string

Serial number of the unit

Returned: always

Sample: “FGVMEVYYQT3AB5352”

status

string

Indication of the operation’s result

Returned: always

Sample: “success”

vdom

string

Virtual domain used

Returned: always

Sample: “root”

version

string

Version of the FortiGate

Returned: always

Sample: “v5.6.3”

Authors

  • Jie Xue (@JieX19)

  • Link Zheng (@chillancezen)

  • Hongbin Lu (@fgtdev-hblu)

  • Frank Shen (@fshen01)