fortinet.fortimanager.fmgr_generic – Build and send generic FortiManager API request.¶
Note
This plugin is part of the fortinet.fortimanager collection (version 2.0.1).
To install it use: ansible-galaxy collection install fortinet.fortimanager
.
To use it in a playbook, specify: fortinet.fortimanager.fmgr_generic
.
New in version 2.10: of fortinet.fortimanager
Synopsis¶
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.
Parameters¶
Notes¶
Note
two parameters schemes are supported, either in raw json format or in ansible recognnizable top-level parameters format.
json is defined as string, user is response for make it json-formatted
method and params should be specified by users if ‘json’ is not present
if all three parameters are provided, the ‘json’ is preferred.
Examples¶
- 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!"
}
]
}
]
}
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
|
Authors¶
Link Zheng (@zhengl)
Jie Xue (@JieX19)
Frank Shen (@fshen01)
Hongbin Lu (@fgtdev-hblu)