fmgd_system_automationaction – Action for automation stitches.

Added in version 1.0.0.

Synopsis

  • This module is able to configure a FortiManager device.

  • Examples include all parameters and values need to be adjusted to data sources before usage.

  • Tested with FortiManager v7.x.

Requirements

The below requirements are needed on the host that executes this module.

  • ansible-core>=2.16.0

FortiManager Version Compatibility

Supported Version Ranges: v7.2.6 -> v7.2.12, v7.4.3 -> latest

Parameters

  • access_token -The token to access FortiManager without using username and password. type: str required: false
  • bypass_validation - Only set to True when module schema diffs with FortiManager API structure, module continues to execute without validating parameters. type: bool required: false default: False
  • enable_log - Enable/Disable logging for task. type: bool required: false default: False
  • forticloud_access_token - Access token of forticloud managed API users, this option is available with FortiManager later than 6.4.0. type: str required: false
  • proposed_method - The overridden method for the underlying Json RPC request. type: str required: false choices: set, update, add
  • rc_succeeded - The rc codes list with which the conditions to succeed will be overriden. type: list required: false
  • rc_failed - The rc codes list with which the conditions to fail will be overriden. type: list required: false
  • state - The directive to create, update or delete an object type: str required: true choices: present, absent
  • workspace_locking_adom - Acquire the workspace lock if FortiManager is running in workspace mode. type: str required: false choices: global, custom adom including root
  • workspace_locking_timeout - The maximum time in seconds to wait for other users to release workspace lock. type: integer required: false default: 300
  • device - The parameter in requested url type: str required: true
  • system_automationaction - Action for automation stitches. type: dict
    • accprofile Access profile for cli script action to access fortigate features. type: list more...
    • action_type (Alias name: action-type) Action type. type: str choices: [email, ios-notification, alert, disable-ssid, quarantine, ban-ip, quarantine-forticlient, aws-lambda, webhook, quarantine-nsx, azure-function, cli-script, google-cloud-function, alicloud-function, slack-notification, quarantine-fortinac, microsoft-teams-notification, fortiexplorer-notification, system-actions, diagnose-script, regular-expression] more...
    • alicloud_access_key_id (Alias name: alicloud-access-key-id) Alicloud accesskey id. type: str more...
    • alicloud_access_key_secret (Alias name: alicloud-access-key-secret) Alicloud accesskey secret. type: list more...
    • alicloud_function_authorization (Alias name: alicloud-function-authorization) Alicloud function authorization type. type: str choices: [anonymous, function] more...
    • aws_api_key (Alias name: aws-api-key) Aws api gateway api key. type: list more...
    • azure_api_key (Alias name: azure-api-key) Azure function api key. type: list more...
    • azure_function_authorization (Alias name: azure-function-authorization) Azure function authorization level. type: str choices: [anonymous, function, admin] more...
    • description Description. type: str more...
    • email_from (Alias name: email-from) Email sender name. type: str more...
    • email_subject (Alias name: email-subject) Email subject. type: str more...
    • email_to (Alias name: email-to) Email addresses. type: list more...
    • execute_security_fabric (Alias name: execute-security-fabric) Enable/disable execution of cli script on all or only one fortigate unit in the security fabric. type: str choices: [disable, enable] more...
    • forticare_email (Alias name: forticare-email) Enable/disable use of your forticare email address as the email-to address. type: str choices: [disable, enable] more...
    • http_body (Alias name: http-body) Request body (if necessary). type: str more...
    • http_headers (Alias name: http-headers) Http headers. type: list more...
      • id Entry id. type: int more...
      • key Request header key. type: str more...
      • value Request header value. type: str more...
    • fmgr_message Message content. type: str more...
    • message_type (Alias name: message-type) Message type. type: str choices: [text, json, form-data] more...
    • method Request method (post, put, get, patch or delete). type: str choices: [delete, get, post, put, patch] more...
    • minimum_interval (Alias name: minimum-interval) Limit execution to no more than once in this interval (in seconds). type: int more...
    • name Name. type: str more...
    • output_size (Alias name: output-size) Number of megabytes to limit script output to (1 - 1024, default = 10). type: int more...
    • port Protocol port. type: int more...
    • protocol Request protocol. type: str choices: [http, https] more...
    • replacement_message (Alias name: replacement-message) Enable/disable replacement message. type: str choices: [disable, enable] more...
    • replacemsg_group (Alias name: replacemsg-group) Replacement message group. type: list more...
    • script Cli script. type: str more...
    • sdn_connector (Alias name: sdn-connector) Nsx sdn connector names. type: list more...
    • security_tag (Alias name: security-tag) Nsx security tag. type: str more...
    • system_action (Alias name: system-action) System action type. type: str choices: [reboot, shutdown, backup-config] more...
    • timeout Maximum running time for this script in seconds (0 = no timeout). type: int more...
    • tls_certificate (Alias name: tls-certificate) Custom tls certificate for api request. type: list more...
    • uri Request api uri. type: str more...
    • verify_host_cert (Alias name: verify-host-cert) Enable/disable verification of the remote host certificate. type: str choices: [disable, enable] more...
    • headers Request headers. type: list more...
    • required Required in action chain. type: str choices: [disable, enable] more...
    • delay Delay before execution (in seconds). type: int more...
    • azure_app (Alias name: azure-app) Azure function application name. type: str more...
    • azure_function (Alias name: azure-function) Azure function name. type: str more...
    • aws_api_path (Alias name: aws-api-path) Aws api gateway path. type: str more...
    • aws_region (Alias name: aws-region) Aws region. type: str more...
    • gcp_function_domain (Alias name: gcp-function-domain) Google cloud function domain. type: str more...
    • alicloud_account_id (Alias name: alicloud-account-id) Alicloud account id. type: str more...
    • alicloud_version (Alias name: alicloud-version) Alicloud version. type: str more...
    • azure_domain (Alias name: azure-domain) Azure function domain. type: str more...
    • aws_api_stage (Alias name: aws-api-stage) Aws api gateway deployment stage name. type: str more...
    • alicloud_region (Alias name: alicloud-region) Alicloud region. type: str more...
    • gcp_function_region (Alias name: gcp-function-region) Google cloud function region. type: str more...
    • aws_api_id (Alias name: aws-api-id) Aws api gateway id. type: str more...
    • alicloud_service (Alias name: alicloud-service) Alicloud service name. type: str more...
    • alicloud_function (Alias name: alicloud-function) Alicloud function name. type: str more...
    • aws_domain (Alias name: aws-domain) Aws domain. type: str more...
    • gcp_project (Alias name: gcp-project) Google cloud platform project name. type: str more...
    • gcp_function (Alias name: gcp-function) Google cloud function name. type: str more...
    • alicloud_function_domain (Alias name: alicloud-function-domain) Alicloud function domain. type: str more...
    • email_body (Alias name: email-body) Email body. type: str more...
    • duration Maximum running time for this script in seconds. type: int more...
    • regular_expression (Alias name: regular-expression) Regular expression string. type: str more...
    • log_debug_print (Alias name: log-debug-print) Enable/disable logging debug print output from diagnose action. type: str choices: [disable, enable] more...
    • password Password. type: list more...
    • output_interval (Alias name: output-interval) Collect the outputs for each output-interval in seconds (0 = no intermediate output). type: int more...
    • file_only (Alias name: file-only) Enable/disable the output in files only. type: str choices: [disable, enable] more...
    • form_data (Alias name: form-data) Form data. type: list more...
      • id Entry id. type: int more...
      • key Key of the part of multipart/form-data. type: str more...
      • value Value of the part of multipart/form-data. type: str more...

Notes

Note

  • Running in workspace locking mode is supported in this FortiManager module, the top level parameters workspace_locking_adom and workspace_locking_timeout help do the work.

  • To create or update an object, use state: present directive.

  • To delete an object, use state: absent directive

  • Normally, running one module can fail when a non-zero rc is returned. you can also override the conditions to fail or succeed with parameters rc_failed and rc_succeeded

Examples

- name: Example playbook (generated based on argument schema)
  hosts: fortimanagers
  connection: httpapi
  gather_facts: false
  vars:
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_httpapi_port: 443
  tasks:
    - name: Action for automation stitches.
      fortinet.fmgdevice.fmgd_system_automationaction:
        # bypass_validation: false
        # workspace_locking_adom: <global or your adom name>
        # workspace_locking_timeout: 300
        # rc_succeeded: [0, -2, -3, ...]
        # rc_failed: [-2, -3, ...]
        device: <your own value>
        state: present # <value in [present, absent]>
        system_automationaction:
          name: "your value" # Required variable, string
          # accprofile: <list or string>
          # action_type: <value in [email, ios-notification, alert, ...]>
          # alicloud_access_key_id: <string>
          # alicloud_access_key_secret: <list or string>
          # alicloud_function_authorization: <value in [anonymous, function]>
          # aws_api_key: <list or string>
          # azure_api_key: <list or string>
          # azure_function_authorization: <value in [anonymous, function, admin]>
          # description: <string>
          # email_from: <string>
          # email_subject: <string>
          # email_to: <list or string>
          # execute_security_fabric: <value in [disable, enable]>
          # forticare_email: <value in [disable, enable]>
          # http_body: <string>
          # http_headers:
          #   - id: <integer>
          #     key: <string>
          #     value: <string>
          # fmgr_message: <string>
          # message_type: <value in [text, json, form-data]>
          # method: <value in [delete, get, post, ...]>
          # minimum_interval: <integer>
          # output_size: <integer>
          # port: <integer>
          # protocol: <value in [http, https]>
          # replacement_message: <value in [disable, enable]>
          # replacemsg_group: <list or string>
          # script: <string>
          # sdn_connector: <list or string>
          # security_tag: <string>
          # system_action: <value in [reboot, shutdown, backup-config]>
          # timeout: <integer>
          # tls_certificate: <list or string>
          # uri: <string>
          # verify_host_cert: <value in [disable, enable]>
          # headers: <list or string>
          # required: <value in [disable, enable]>
          # delay: <integer>
          # azure_app: <string>
          # azure_function: <string>
          # aws_api_path: <string>
          # aws_region: <string>
          # gcp_function_domain: <string>
          # alicloud_account_id: <string>
          # alicloud_version: <string>
          # azure_domain: <string>
          # aws_api_stage: <string>
          # alicloud_region: <string>
          # gcp_function_region: <string>
          # aws_api_id: <string>
          # alicloud_service: <string>
          # alicloud_function: <string>
          # aws_domain: <string>
          # gcp_project: <string>
          # gcp_function: <string>
          # alicloud_function_domain: <string>
          # email_body: <string>
          # duration: <integer>
          # regular_expression: <string>
          # log_debug_print: <value in [disable, enable]>
          # password: <list or string>
          # output_interval: <integer>
          # file_only: <value in [disable, enable]>
          # form_data:
          #   - id: <integer>
          #     key: <string>
          #     value: <string>

Return Values

Common return values are documented: https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values, the following are the fields unique to this module:

  • meta - The result of the request.returned: always type: dict
    • request_url - The full url requested. returned: always type: str sample: /sys/login/user
    • response_code - The status of api request. returned: always type: int sample: 0
    • response_data - The data body of the api response. returned: optional type: list or dict
    • response_message - The descriptive message of the api response. returned: always type: str sample: OK
    • system_information - The information of the target system. returned: always type: dict
  • rc - The status the request. returned: always type: int sample: 0
  • version_check_warning - Warning if the parameters used in the playbook are not supported by the current FortiManager version. returned: if at least one parameter not supported by the current FortiManager version type: list

Status

  • This module is not guaranteed to have a backwards compatible interface.

Authors

  • Xinwei Du (@dux-fortinet)

  • Xing Li (@lix-fortinet)

  • Jie Xue (@JieX19)

  • Link Zheng (@chillancezen)

  • Frank Shen (@fshen01)

  • Hongbin Lu (@fgtdev-hblu)