fortiswitch_export_config_playbook – Convert the returned facts into a playbook.

New in version 2.11.

Synopsis

  • Collect the current configurations of a module on a running device and converts 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.fortiswitch >= 1.0.0.

Parameters

  • enable_log - Enable/Disable logging for task. type: bool required: False default: False
  • filters - A list of expressions to filter the returned results. type: list required: False more...
  • sorters - A list of expressions to sort the returned results. type: list required: False more...
  • formatters - A list of fields to display for returned results. type: list required: False
  • selector - selector that used to collect the current configurations of the module and convert to a playbook. type: str choices:
    • alertemail_setting
    • gui_console
    • log.disk_filter
    • log.disk_setting
    • log.fortianalyzer2_filter
    • log.fortianalyzer2_setting
    • log.fortianalyzer3_filter
    • log.fortianalyzer3_setting
    • log.fortianalyzer_filter
    • log.fortianalyzer_override-filter
    • log.fortianalyzer_override-setting
    • log.fortianalyzer_setting
    • log.fortiguard_setting
    • log.memory_filter
    • log.memory_global-setting
    • log.memory_setting
    • log.remote_setting
    • log.syslogd2_filter
    • log.syslogd2_setting
    • log.syslogd3_filter
    • log.syslogd3_setting
    • log.syslogd_filter
    • log.syslogd_override-filter
    • log.syslogd_override-setting
    • log.syslogd_setting
    • log_custom-field param: id type: str required: True
    • log_eventfilter
    • log_gui
    • router_access-list param: name type: str required: True
    • router_access-list6 param: name type: str required: True
    • router_aspath-list param: name type: str required: True
    • router_auth-path param: name type: str required: True
    • router_bgp
    • router_community-list param: name type: str required: True
    • router_gwdetect param: interface type: str required: True
    • router_isis
    • router_key-chain param: name type: str required: True
    • router_multicast
    • router_multicast-flow param: name type: str required: True
    • router_ospf
    • router_ospf6
    • router_policy param: seq_num type: int required: True
    • router_prefix-list param: name type: str required: True
    • router_prefix-list6 param: name type: str required: True
    • router_rip
    • router_ripng
    • router_route-map param: name type: str required: True
    • router_setting
    • router_static param: seq_num type: int required: True
    • router_static6 param: seq_num type: int required: True
    • router_vrf param: name type: str required: True
    • switch-controller_global
    • switch.acl.service_custom param: name type: str required: True
    • switch.acl_802-1X param: id type: int required: True
    • switch.acl_egress param: id type: int required: True
    • switch.acl_ingress param: id type: int required: True
    • switch.acl_policer param: id type: int required: True
    • switch.acl_prelookup param: id type: int required: True
    • switch.acl_settings
    • switch.igmp-snooping_globals
    • switch.lldp_profile param: name type: str required: True
    • switch.lldp_settings
    • switch.macsec_profile param: name type: str required: True
    • switch.mld-snooping_globals
    • switch.network-monitor_directed param: id type: int required: True
    • switch.network-monitor_settings
    • switch.ptp_policy param: name type: str required: True
    • switch.ptp_settings
    • switch.qos_dot1p-map param: name type: str required: True
    • switch.qos_ip-dscp-map param: name type: str required: True
    • switch.qos_qos-policy param: name type: str required: True
    • switch.stp_instance param: id type: str required: True
    • switch.stp_settings
    • switch_auto-isl-port-group param: name type: str required: True
    • switch_auto-network
    • switch_domain param: name type: str required: True
    • switch_global
    • switch_interface param: name type: str required: True
    • switch_ip-mac-binding param: seq_num type: int required: True
    • switch_mirror param: name type: str required: True
    • switch_phy-mode
    • switch_physical-port param: name type: str required: True
    • switch_quarantine param: mac type: str required: True
    • switch_raguard-policy param: name type: str required: True
    • switch_security-feature
    • switch_static-mac param: seq_num type: int required: True
    • switch_storm-control
    • switch_trunk param: name type: str required: True
    • switch_virtual-wire param: name type: str required: True
    • switch_vlan param: id type: int required: True
    • switch_vlan-tpid param: name type: str required: True
    • system.alias_command param: name type: str required: True
    • system.alias_group param: name type: str required: True
    • system.autoupdate_clientoverride
    • system.autoupdate_override
    • system.autoupdate_push-update
    • system.autoupdate_schedule
    • system.autoupdate_tunneling
    • system.certificate_ca param: name type: str required: True
    • system.certificate_crl param: name type: str required: True
    • system.certificate_local param: name type: str required: True
    • system.certificate_ocsp
    • system.certificate_remote param: name type: str required: True
    • system.dhcp_server param: id type: int required: True
    • system.schedule_group param: name type: str required: True
    • system.schedule_onetime param: name type: str required: True
    • system.schedule_recurring param: name type: str required: True
    • system.snmp_community param: id type: int required: True
    • system.snmp_sysinfo
    • system.snmp_user param: name type: str required: True
    • system_accprofile param: name type: str required: True
    • system_admin param: name type: str required: True
    • system_alarm
    • system_alertemail
    • system_arp-table param: id type: int required: True
    • system_bug-report
    • system_central-management
    • system_console
    • system_dns
    • system_dns-database param: name type: str required: True
    • system_dns-server param: name type: str required: True
    • system_flan-cloud
    • system_flow-export
    • system_fm
    • system_fortianalyzer
    • system_fortianalyzer2
    • system_fortianalyzer3
    • system_fortiguard
    • system_fortiguard-log
    • system_fortimanager
    • system_fsw-cloud
    • system_global
    • system_interface param: name type: str required: True
    • system_ipv6-neighbor-cache param: id type: int required: True
    • system_link-monitor param: name type: str required: True
    • system_location param: name type: str required: True
    • system_mac-address-table param: mac type: str required: True
    • system_management-tunnel
    • system_ntp
    • system_object-tag param: name type: str required: True
    • system_password-policy
    • system_port-pair param: name type: str required: True
    • system_proxy-arp param: id type: int required: True
    • system_resource-limits
    • system_session-ttl
    • system_settings
    • system_sflow
    • system_sniffer-profile param: profile_name type: str required: True
    • system_tos-based-priority param: id type: int required: True
    • system_vdom param: name type: str required: True
    • system_vdom-dns
    • system_vdom-property param: name type: str required: True
    • system_zone param: name type: str required: True
    • user_group param: name type: str required: True
    • user_ldap param: name type: str required: True
    • user_local param: name type: str required: True
    • user_peer param: name type: str required: True
    • user_peergrp param: name type: str required: True
    • user_radius param: name type: str required: True
    • user_setting
    • user_tacacs+ param: name type: str required: True
  • params - the parameter for each selector, see definition in above list.type: dict
  • selectors - selectors list allows to pass more than one selector and its parameters in a task.type: list
  • output_path - The path that is used to save the generated playbooks.type: str

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 generated playbooks will be stored at the specified output path.
  • The default value for state is present, please set the value to absent if needed.

Examples

- hosts: fortiswitch01
  connection: httpapi
  collections:
    - fortinet.fortiswitch
  vars:
    ansible_httpapi_use_ssl: yes
    ansible_httpapi_validate_certs: no
    ansible_httpapi_port: 443
  tasks:
  - name: Export multiple palybooks
    fortiswitch_export_config_playbook:
      selectors:
      - selector: system_interface
        params:
          name: "internal"
      output_path: "./"

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 FortiGate returned: always type: str sample: GET
  • name - Name of the table used to fulfill the request returned: always type: str sample: firmware
  • path - Path of the table used to fulfill the request returned: always type: str sample: system
  • results - Object list retrieved from device. returned: always type: list
  • serial - Serial number of the unit returned: always type: str sample: FGVMEVYYQT3AB5352
  • status - Indication of the operation's result returned: always type: str sample: success
  • version - Version of the FortiGate returned: always type: str sample: v5.6.3
  • ansible_facts - The list of fact subsets collected from the device returned: always type: dict

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 (@fshen01)

Hint

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