community.general.fmgr_script (0.1.1) — module

Add/Edit/Delete and execute scripts

Authors: Andrew Welsh (@Ghilli3)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: EXECUTE SCRIPT
  fmgr_script:
    adom: "root"
    script_name: "TestScript"
    mode: "execute"
    script_scope: "FGT1,FGT2"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: DELETE SCRIPT
  fmgr_script:
    adom: "root"
    script_name: "TestScript"
    mode: "delete"

Inputs

    
adom:
    description:
    - The administrative domain (admon) the configuration belongs to
    required: true

mode:
    choices:
    - add
    - delete
    - execute
    - set
    default: add
    description:
    - The desired mode of the specified object. Execute will run the script.
    required: false

vdom:
    description:
    - The virtual domain (vdom) the configuration belongs to

script_name:
    description:
    - The name of the script.
    required: true

script_type:
    description:
    - The type of script (CLI or TCL).
    required: false

script_scope:
    description:
    - (datasource) The devices that the script will run on, can have both device member
      and device group member.
    required: false

script_target:
    description:
    - The target of the script to be run.
    required: false

script_content:
    description:
    - The script content that will be executed.
    required: false

script_package:
    description:
    - (datasource) Policy package object to run the script against
    required: false

script_description:
    description:
    - The description of the script.
    required: false

Outputs

api_result:
  description: full API response, includes status code and message
  returned: always
  type: str