W3cubDocs

/Ansible 2.9

fmgr_query – Query FortiManager data objects for use in Ansible workflows

New in version 2.8.

Synopsis

  • Provides information on data objects within FortiManager so that playbooks can perform conditionals.

Parameters

Parameter Choices/Defaults Comments
adom
-
Default:
"root"
The ADOM the configuration should belong to.
custom_dict
-
ADVANCED USERS ONLY! REQUIRES KNOWLEDGE OF FMGR JSON API!
DICTIONARY JSON FORMAT ONLY -- Custom dictionary/datagram to send to the endpoint.
custom_endpoint
-
ADVANCED USERS ONLY! REQUIRES KNOWLEDGE OF FMGR JSON API!
The HTTP Endpoint on FortiManager you wish to GET from.
device_ip
-
The IP of the device you want to query.
device_serial
-
The serial number of the device you want to query.
device_unique_name
-
The desired "friendly" name of the device you want to query.
nodes
-
A LIST of firewalls in the cluster you want to verify i.e. ["firewall_A","firewall_B"].
object
- / required
    Choices:
  • device
  • cluster_nodes
  • task
  • custom
The data object we wish to query (device, package, rule, etc). Will expand choices as improves.
task_id
-
The ID of the task you wish to query status on. If left blank and object = 'task' a list of tasks are returned.

Notes

Examples

- name: QUERY FORTIGATE DEVICE BY IP
  fmgr_query:
    object: "device"
    adom: "ansible"
    device_ip: "10.7.220.41"

- name: QUERY FORTIGATE DEVICE BY SERIAL
  fmgr_query:
    adom: "ansible"
    object: "device"
    device_serial: "FGVM000000117992"

- name: QUERY FORTIGATE DEVICE BY FRIENDLY NAME
  fmgr_query:
    adom: "ansible"
    object: "device"
    device_unique_name: "ansible-fgt01"

- name: VERIFY CLUSTER MEMBERS AND STATUS
  fmgr_query:
    adom: "ansible"
    object: "cluster_nodes"
    device_unique_name: "fgt-cluster01"
    nodes: ["ansible-fgt01", "ansible-fgt02", "ansible-fgt03"]

- name: GET STATUS OF TASK ID
  fmgr_query:
    adom: "ansible"
    object: "task"
    task_id: "3"

- name: USE CUSTOM TYPE TO QUERY AVAILABLE SCRIPTS
  fmgr_query:
    adom: "ansible"
    object: "custom"
    custom_endpoint: "/dvmdb/adom/ansible/script"
    custom_dict: { "type": "cli" }

Return Values

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

Key Returned Description
api_result
string
always
full API response, includes status code and message



Status

Authors

  • Luke Weighall (@lweighall)

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/fmgr_query_module.html