drmofu / drmofu.fortimanager / 2.2.2 / module / fmgr_generic Build and send generic FortiManager API request. | "added in version" 2.0.0 of drmofu.fortimanager" Authors: Xinwei Du (@dux-fortinet), Xing Li (@lix-fortinet), Link Zheng (@zhengl), Jie Xue (@JieX19), Frank Shen (@fshen01), Hongbin Lu (@fgtdev-hblu) preview | supported by communitydrmofu.fortimanager.fmgr_generic (2.2.2) — module
Install with ansible-galaxy collection install drmofu.fortimanager:==2.2.2
collections: - name: drmofu.fortimanager version: 2.2.2
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.
- 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!" } ] } ] }
json: description: - the raw json-formatted payload to send to fortimanager required: false type: str method: description: - the method of the json-rpc - it must be in [get, add, set, update, delete, move, clone, exec] required: false type: str params: description: - the parameter collection. elements: dict required: false type: list rc_failed: description: the rc codes list with which the conditions to fail will be overriden elements: int required: false type: list enable_log: default: false description: Enable/Disable logging for task required: false type: bool rc_succeeded: description: the rc codes list with which the conditions to succeed will be overriden elements: int required: false type: list workspace_locking_adom: description: no description required: false type: str forticloud_access_token: description: authenticate Ansible client with forticloud API access token required: false type: str workspace_locking_timeout: default: 300 description: no description required: false type: int
api_result: description: full API response, includes status code and message returned: always type: str