ansible.builtin.fortios_system_firmware_upgrade (v2.9.27) — module

Perform firmware upgrade on FortiGate or FortiOS (FOS) device.

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

Authors: Don Yao (@fortinetps), Miguel Angel Munoz (@mamunozgonzalez), Nicolas Thomas (@thomnico)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

This module is able to perform firmware upgrade on FortiGate or FortiOS (FOS) device by specifying firmware upgrade source, filename and whether format boot partition before upgrade. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.2


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- hosts: localhost
  vars:
   host: "192.168.122.40"
   username: "admin"
   password: ""
   vdom: "root"
   ssl_verify: "False"
  tasks:
  - name: Perform firmware upgrade with local firmware file.
    fortios_system_firmware:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      ssl_verify: "False"
      system_firmware:
        file_content: "<your_own_value>"
        filename: "<your_own_value>"
        format_partition: "<your_own_value>"
        source: "upload"
    register: fortios_system_firmware_upgrade_result

  - debug:
      var:
        # please check the following status to confirm
        fortios_system_firmware_upgrade_result.meta.results.status

  - name: Perform firmware upgrade with firmware file on USB.
    fortios_system_firmware_upgrade:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      ssl_verify: "False"
      system_firmware:
        filename: "<your_own_value>"
        format_partition: "<your_own_value>"
        source: "usb"
    register: fortios_system_firmware_upgrade_result

  - debug:
      var:
        # please check the following status to confirm
        fortios_system_firmware_upgrade_result.meta.results.status

  - name: Perform firmware upgrade from FortiGuard.
    fortios_system_firmware_upgrade:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      ssl_verify: "False"
      system_firmware:
        filename: "<your_own_value>"
        format_partition: "<your_own_value>"
        source: "fortiguard"
    register: fortios_system_firmware_upgrade_result

  - debug:
      var:
        # please check the following status to confirm
        fortios_system_firmware_upgrade_result.meta.results.status

Inputs

    
host:
    description:
    - FortiOS or FortiGate IP address.
    required: false
    type: str

vdom:
    default: root
    description:
    - 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.
    required: false
    type: str

https:
    default: true
    description:
    - Indicates if the requests towards FortiGate must use HTTPS protocol.
    required: false
    type: bool

password:
    default: ''
    description:
    - FortiOS or FortiGate password.
    type: str

username:
    description:
    - FortiOS or FortiGate username.
    required: false
    type: str

ssl_verify:
    default: true
    description:
    - Ensures FortiGate certificate must be verified by a proper CA.
    required: false
    type: bool

system_firmware:
    default: null
    description:
    - Possible parameters to go in the body for the request. Specify firmware upgrade
      source, filename and whether format boot partition before upgrade
    required: true
    suboptions:
      file_content:
        description:
        - 'Provided when uploading a file: base64 encoded file data. Must not contain
          whitespace or other invalid base64 characters. Must be included in HTTP body.'
        required: false
        type: str
      filename:
        description:
        - Name and path of the local firmware file.
        required: true
        type: str
      format_partition:
        description:
        - Set to true to format boot partition before upgrade.
        required: false
        type: bool
      source:
        choices:
        - upload
        - usb
        - fortiguard
        description:
        - Firmware file data source [upload|usb|fortiguard].
        required: true
        type: str
    type: dict

Outputs

build:
  description: Build number of the fortigate image
  returned: always
  sample: '1547'
  type: str
http_method:
  description: Last method used to provision the content into FortiGate
  returned: always
  sample: POST
  type: str
name:
  description: Name of the table used to fulfill the request
  returned: always
  sample: firmware
  type: str
path:
  description: Path of the table used to fulfill the request
  returned: always
  sample: system
  type: str
revision:
  description: Internal revision number
  returned: always
  sample: 17.0.2.10658
  type: str
serial:
  description: Serial number of the unit
  returned: always
  sample: FGVMEVYYQT3AB5352
  type: str
status:
  description: Indication of the operation's result
  returned: always
  sample: success
  type: str
vdom:
  description: Virtual domain used
  returned: always
  sample: root
  type: str
version:
  description: Version of the FortiGate
  returned: always
  sample: v5.6.3
  type: str