fortios_json_generic
Execute FortiOS API operations through native controller HTTPAPI; monitor actions report changed=false; generic results are private
Collection: fortinet.fortios
Full Name: fortinet.fortios.fortios_json_generic
Controller module — runs on the local controller, not on remote hosts.
Synopsis
Execute FortiOS API operations through native controller HTTPAPI; monitor actions report changed=false; generic results are private
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| access_token | str | |||
| enable_log | bool | false | ||
| headers | dict | |||
| json_generic | dict | |||
| vdom | str | root |
Example
yaml
- fortinet.fortios.fortios_json_generic:
json_generic:
jsonbody: |
{
"name": "111",
"type": "geography",
"fqdn": "",
"country": "AL",
"comment": "ccc",
"visibility": "enable",
"associated-interface": "port1",
"allow-routing": "disable"
}
method: POST
path: /api/v2/cmdb/firewall/address
vdom: root
name: add firewall address
register: info
- fortinet.fortios.fortios_json_generic:
json_generic:
method: DELETE
path: /api/v2/cmdb/firewall/address/111
vdom: root
name: delete firewall address
register: info
- fortinet.fortios.fortios_json_generic:
json_generic:
dictbody:
allow-routing: disable
associated-interface: port1
comment: it's a test
country: AL
fqdn: ""
name: "111"
type: geography
visibility: enable
method: POST
path: /api/v2/cmdb/firewall/address
vdom: root
name: test add with dict
register: info
- fortinet.fortios.fortios_json_generic:
json_generic:
method: PUT
path: /api/v2/cmdb/firewall/policy/1
specialparams: action=move&after=2
vdom: root
name: test speical params
register: info
# Administrative confirmation requires ansible_password in the inventory.
# Define these inventory variables: fortios_api_profile_name, fortios_api_user_name.
- fortinet.fortios.fortios_json_generic:
headers:
X-Admin-Passwd: true
json_generic:
dictbody:
accprofile: '{{ fortios_api_profile_name }}'
name: '{{ fortios_api_user_name }}'
method: POST
path: /api/v2/cmdb/system/api-user
vdom: root
name: test request headers
register: info