ansible.builtin.fortios_config (v2.9.23) — module

Manage config on Fortinet FortiOS firewall devices

| "added in version" 2.3 of ansible.builtin"

Authors: Benjamin Jolivot (@bjolivot)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.23

Description

This module provides management of FortiOS Devices configuration.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Backup current config
  fortios_config:
    host: 192.168.0.254
    username: admin
    password: password
    backup: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Backup only address objects
  fortios_config:
    host: 192.168.0.254
    username: admin
    password: password
    backup: yes
    backup_path: /tmp/forti_backup/
    filter: "firewall address"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update configuration from file
  fortios_config:
    host: 192.168.0.254
    username: admin
    password: password
    src: new_configuration.conf.j2

Inputs

    
src:
    description:
    - The I(src) argument provides a path to the configuration template to load into the
      remote device.

host:
    description:
    - Specifies the DNS hostname or IP address for connecting to the remote fortios device.
      Required when I(file_mode) is False.
    type: str

vdom:
    description:
    - Specifies on which vdom to apply configuration
    type: str

backup:
    default: false
    description:
    - This argument will cause the module to create a backup of the current C(running-config)
      from the remote device before any changes are made.  The backup file is written
      to the i(backup) folder.
    type: bool

filter:
    default: ''
    description:
    - Only for partial backup, you can restrict by giving expected configuration path
      (ex. firewall address).

timeout:
    default: 60
    description:
    - Timeout in seconds for connecting to the remote device.
    type: int

password:
    description:
    - Specifies the password used to authenticate to the remote device. Required when
      I(file_mode) is True.
    type: str

username:
    description:
    - Configures the username used to authenticate to the remote device. Required when
      I(file_mode) is True.
    type: str

file_mode:
    default: false
    description:
    - Don't connect to any device, only use I(config_file) as input and Output.
    type: bool
    version_added: '2.4'
    version_added_collection: fortinet.fortios

backup_path:
    description:
    - Specifies where to store backup files. Required if I(backup=yes).
    type: path

config_file:
    description:
    - Path to configuration file. Required when I(file_mode) is True.
    type: path
    version_added: '2.4'
    version_added_collection: fortinet.fortios

backup_filename:
    description:
    - Specifies the backup filename. If omitted filename will be formatted like HOST_config.YYYY-MM-DD@HH:MM:SS
    type: str

Outputs

change_string:
  description: The commands really executed by the module
  returned: only if config changed
  type: str
running_config:
  description: full config string
  returned: always
  type: str