ansible.builtin.fmgr_script (v2.5.6) — module

Add/Edit/Delete and execute scripts

| "added in version" 2.5 of ansible.builtin"

Authors: Andrew Welsh

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.5.6

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

Inputs

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

host:
    description:
    - The FortiManager's Address.
    required: true

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

state:
    choices:
    - present
    - execute
    - delete
    default: present
    description:
    - The desired state of the specified object.
    - present - will create a script.
    - execute - execute the scipt.
    - delete - delete the script.
    required: false

password:
    description:
    - The password associated with the username account.
    required: false

username:
    description:
    - The username to log into the FortiManager
    required: true

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: string