fmgr_script - Add/Edit/Delete and execute scripts

New in version 2.5.

Synopsis

Parameters

Parameter Choices/Defaults Comments
adom
required
The administrative domain (admon) the configuration belongs to
host
required
The FortiManager's Address.
password
The password associated with the username account.
script_content
The script content that will be executed.
script_description
The description of the script.
script_name
required
The name of the script.
script_package
(datasource) Policy package object to run the script against
script_scope
(datasource) The devices that the script will run on, can have both device member and device group member.
script_target
The target of the script to be run.
script_type
The type of script (CLI or TCL).
state
    Choices:
  • present ←
  • execute
  • delete
The desired state of the specified object.
present - will create a script.
execute - execute the scipt.
delete - delete the script.
username
required
The username to log into the FortiManager
vdom
The virtual domain (vdom) the configuration belongs to

Examples

- name: CREATE SCRIPT
  fmgr_script:
    host: "{{inventory_hostname}}"
    username: "{{ username }}"
    password: "{{ password }}"
    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
  fmgr_script:
    host: "{{inventory_hostname}}"
    username: "{{ username }}"
    password: "{{ password }}"
    adom: "root"
    script_name: "TestScript"
    state: "execute"
    script_scope: "FGT1,FGT2"

- name: DELETE SCRIPT
  fmgr_script:
    host: "{{inventory_hostname}}"
    username: "{{ username }}"
    password: "{{ password }}"
    adom: "root"
    script_name: "TestScript"
    state: "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



Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Andrew Welsh

Hint

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