- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# fmgr_script – Add/Edit/Delete and execute scripts

New in version 2.5.

- Synopsis
- Parameters
- Notes
- Examples
- Return Values
- Status

## Synopsis

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

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
adom - / required |  | The administrative domain (admon) the configuration belongs to
mode - added in 2.8 | Choices: add ← delete execute set | The desired mode of the specified object. Execute will run the script.
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).
vdom - |  | The virtual domain (vdom) the configuration belongs to

## Notes

Note

- Full Documentation at https://ftnt-ansible-docs.readthedocs.io/en/latest/.

## Examples

    - name: CREATE SCRIPT
      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
      fmgr_script:
        adom: "root"
        script_name: "TestScript"
        mode: "execute"
        script_scope: "FGT1,FGT2"

    - name: DELETE SCRIPT
      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

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]

### Authors

- Andrew Welsh (@Ghilli3)

Hint

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