chillancezen.fortimanager.fmgr_generic (2.1.6) — module

Build and send generic FortiManager API request.

| "added in version" 2.10 of chillancezen.fortimanager"

Authors: Link Zheng (@zhengl), Jie Xue (@JieX19), Frank Shen (@fshen01), Hongbin Lu (@fgtdev-hblu)

preview | supported by community

Install collection

Install with ansible-galaxy collection install chillancezen.fortimanager:==2.1.6


Add to requirements.yml

  collections:
    - name: chillancezen.fortimanager
      version: 2.1.6

Description

This module is for generic fortimanager requests. it receives raw json-rpc data, and sends it to fortimanager, finally returns the response to users.

This module also rely on fortimanager httpapi plugin as the transport.

the payload doesn't include session, the httpapi plugin will automatically fill the session later.

the username and password is not managed by the module, but by the plugin.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- hosts: fortimanager01
  connection: httpapi
  vars:
    adom: "root"
    ansible_httpapi_use_ssl: True
    ansible_httpapi_validate_certs: False
    ansible_httpapi_port: 443
  tasks:
    -   name: 'login a user'
        fmgr_generic:
             method: 'exec'
             params:
                - url: 'sys/login/user'
                  data:
                   - user: 'APIUser'
                     passwd: 'Fortinet1!e'
    -   name: 'login another user'
        fmgr_generic:
             json: |
                  {
                   "method":"exec",
                   "params":[
                    {
                         "url":"sys/login/user",
                         "data":[
                            {
                               "user":"APIUser",
                               "passwd":"Fortinet1!"
                            }
                          ]
                     }
                    ]
                  }

Inputs

    
json:
    description:
    - the raw json-formatted payload to send to fortimanager

method:
    description:
    - the method of the json-rpc
    - it must be in [get, add, set, update, delete, move, clone, exec]

params:
    description:
    - the parameter collection.

enable_log:
    default: false
    description: Enable/Disable logging for task
    required: false
    type: bool

Outputs

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