community.network.fmgr_script – Add/Edit/Delete and execute scripts

Note

This plugin is part of the community.network collection.

To install it use: ansible-galaxy collection install community.network.

To use it in a playbook, specify: community.network.fmgr_script.

Synopsis

  • Create/edit/delete scripts and execute the scripts on the FortiManager using jsonrpc API

Parameters

Parameter Choices/Defaults Comments
adom
string / required
The administrative domain (admon) the configuration belongs to
mode
string
    Choices:
  • add ←
  • delete
  • execute
  • set
The desired mode of the specified object. Execute will run the script.
script_content
string
The script content that will be executed.
script_description
string
The description of the script.
script_name
string / required
The name of the script.
script_package
string
(datasource) Policy package object to run the script against
script_scope
string
(datasource) The devices that the script will run on, can have both device member and device group member.
script_target
string
The target of the script to be run.
script_type
string
The type of script (CLI or TCL).
vdom
string
The virtual domain (vdom) the configuration belongs to

Examples

- name: CREATE SCRIPT
  community.network.fmgr_script:
    adom: "root"
    script_name: "TestScript"
    script_type: "cli"
    script_target: "remote_device"
    script_description: "Create by Ansible"
    script_content: "get system status"

- name: EXECUTE SCRIPT
  community.network.fmgr_script:
    adom: "root"
    script_name: "TestScript"
    mode: "execute"
    script_scope: "FGT1,FGT2"

- name: DELETE SCRIPT
  community.network.fmgr_script:
    adom: "root"
    script_name: "TestScript"
    mode: "delete"

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



Authors

  • Andrew Welsh (@Ghilli3)