fortios_facts – Get facts about fortios devices

From Get docs
Ansible/docs/2.9/modules/fortios facts module


fortios_facts – Get facts about fortios devices

New in version 2.9.


Synopsis

  • Collects facts from network devices running the fortios operating system. This module places the facts gathered in the fact tree keyed by the respective resource name. This facts module will only collect those facts which user specified in playbook.

Requirements

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

  • fortiosapi>=0.9.8

Parameters

Parameter Choices/Defaults Comments

gather_subset

list / elements=dictionary / required

When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include system_current-admins_select, system_firmware_select, system_fortimanager_status, system_ha-checksums_select, system_interface_select, system_status_select and system_time_select

fact

string / required

Name of the facts to gather

filters

list / elements=dictionary

Filters apply when gathering facts

host

string

FortiOS or FortiGate IP address.

https

boolean

  • no
  • yes

Indicates if the requests towards FortiGate must use HTTPS protocol.

password

string

Default:

""

FortiOS or FortiGate password.

ssl_verify

boolean

  • no

  • yes

Ensures FortiGate certificate must be verified by a proper CA.

username

string

FortiOS or FortiGate username.

vdom

string

Default:

"root"

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.



Notes

Note

  • Support both legacy mode (local_action) and httpapi
  • Legacy mode run as a local_action in your playbook, requires fortiosapi library developed by Fortinet
  • httpapi mode is the new recommend way for network modules


Examples

- hosts: localhost
  vars:
    host: "192.168.122.40"
    username: "admin"
    password: ""
    vdom: "root"
    ssl_verify: "False"

  tasks:
  - name: gather basic system status facts
    fortios_facts:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      gather_subset:
        - fact: 'system_status_select'

  - name: gather all physical interfaces status facts
    fortios_facts:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      gather_subset:
        - fact: 'system_interface_select'

  - name: gather gather all physical and vlan interfaces status facts
    fortios_facts:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      gather_subset:
        - fact: 'system_interface_select'
          filters:
            - include_vlan: true

  - name: gather basic system info and physical interface port3 status facts
    fortios_facts:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      gather_subset:
        - fact: 'system_status_select'
        - fact: 'system_interface_select'
          filters:
            - interface_name: 'port3'

Return Values

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

Key Returned Description

build

string

always

Build number of the fortigate image


Sample:

1547

http_method

string

always

Last method used to provision the content into FortiGate


Sample:

GET

name

string

always

Name of the table used to fulfill the request


Sample:

firmware

path

string

always

Path of the table used to fulfill the request


Sample:

system

revision

string

always

Internal revision number


Sample:

17.0.2.10658

serial

string

always

Serial number of the unit


Sample:

FGVMEVYYQT3AB5352

status

string

always

Indication of the operation's result


Sample:

success

vdom

string

always

Virtual domain used


Sample:

root

version

string

always

Version of the FortiGate


Sample:

v5.6.3




Status

Authors

  • Don Yao (@fortinetps)
  • Miguel Angel Munoz (@mamunozgonzalez)
  • Nicolas Thomas (@thomnico)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.


© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/fortios_facts_module.html