fortinet.fortimanager.fmgr_pkg_firewall_policy module – Configure IPv4 policies.
Note
This module is part of the fortinet.fortimanager collection (version 2.8.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install fortinet.fortimanager
.
To use it in a playbook, specify: fortinet.fortimanager.fmgr_pkg_firewall_policy
.
New in fortinet.fortimanager 1.0.0
Synopsis
This module is able to configure a FortiManager device.
Examples include all parameters and values which need to be adjusted to data sources before usage.
Parameters
Parameter |
Comments |
---|---|
The token to access FortiManager without using username and password. |
|
The parameter (adom) in requested url. |
|
Only set to True when module schema diffs with FortiManager API structure, module continues to execute without validating parameters. Choices:
|
|
Enable/Disable logging for task. Choices:
|
|
Authenticate Ansible client with forticloud API access token. |
|
The parameter (pkg) in requested url. |
|
The top level parameters set. |
|
Assigned policy block. |
|
Policy action Choices:
|
|
Enable/disable anti-replay check. Choices:
|
|
(list or str) Application category ID list. |
|
(list or str) Application group names. |
|
(list) Application ID list. |
|
Name of an existing Application list. |
|
HTTPS server certificate for policy authentication. |
|
Enable/disable authentication-based routing. Choices:
|
|
HTTP-to-HTTPS redirect address for firewall authentication. |
|
Enable/disable offloading security profile processing to CP processors. Choices:
|
|
Name of an existing Antivirus profile. |
|
Enable/disable the use of best route. Choices:
|
|
Enable/disable block notification. Choices:
|
|
Enable to exempt some users from the captive portal. Choices:
|
|
Enable/disable capture packets. Choices:
|
|
Name of an existing CASB profile. |
|
CASI profile. |
|
Enable/Disable CGN endpoint independent filtering. Choices:
|
|
Enable/Disable CGN endpoint independent mapping Choices:
|
|
NP log server group name |
|
Resource quota |
|
Session quota |
|
Enable/disable software endpoint independent filtering control. Choices:
|
|
Name of an existing CIFS profile. |
|
(dict or str) Comments. |
|
(list or str) Custom fields to append to log messages for this policy. |
|
Decrypted traffic mirror. |
|
Enable TCP NPU session delay to guarantee packet order of 3-way handshake. Choices:
|
|
Enable/disable TCP NPU session delay in order to guarantee packet order of 3-way handshake. Choices:
|
|
(list or str) Names of devices or device groups that can be matched by the policy. |
|
Name of an existing Diameter filter profile. |
|
Enable to copy packets DiffServ values from sessions original direction to its reply direction. Choices:
|
|
Enable to change packets DiffServ values to the specified diffservcode-forward value. Choices:
|
|
Enable to change packets reverse Choices:
|
|
Change packets DiffServ to this value. |
|
Change packets reverse |
|
Enable/disable user authentication disclaimer. Choices:
|
|
Name of an existing DLP profile. |
|
Name of an existing DLP sensor. |
|
Name of an existing DNS filter profile. |
|
Enable DSCP check. Choices:
|
|
Enable negated DSCP match. Choices:
|
|
DSCP value. |
|
Enable DSRI to ignore HTTP server responses. Choices:
|
|
(list or str) Destination address and address group names. |
|
(list or str) Destination IPv6 address name and address group names. |
|
When enabled dstaddr6 specifies what the destination address must NOT be. Choices:
|
|
When enabled dstaddr specifies what the destination address must NOT be. Choices:
|
|
(list or str) Outgoing |
|
Enable/disable dynamic RADIUS defined traffic shaping. Choices:
|
|
Enable/Disable check endpoint-independent-filtering pinhole. Choices:
|
|
Enable/Disable learning of end-point-independent filtering pinhole. Choices:
|
|
Enable/disable email collection. Choices:
|
|
Name of an existing email filter profile. |
|
Enable/disable Forward Error Correction on traffic matching this policy on a FEC device. Choices:
|
|
Name of an existing file-filter profile. |
|
How to handle sessions if the configuration of this firewall policy changes. Choices:
|
|
Enable to prevent source NAT from changing a sessions source port. Choices:
|
|
Enable/disable Fortinet Single Sign-On. Choices:
|
|
FSSO agent to use for NTLM authentication. |
|
(list or str) Names of FSSO groups. |
|
Enable/disable recognition of anycast IP addresses using the geography IP database. Choices:
|
|
Match geography address based either on its physical location or registered location. Choices:
|
|
Label for the policy that appears when the GUI is in Global View mode. |
|
(list or str) Names of user groups that can authenticate with this policy. |
|
GTP profile. |
|
Redirect HTTP Choices:
|
|
Name of an existing ICAP profile. |
|
Name of identity-based routing rule. |
|
Policy-based IPsec VPN Choices:
|
|
Policy inspection mode Choices:
|
|
Enable/disable use of Internet Services for this policy. Choices:
|
|
Enable/disable use of IPv6 Internet Services for this policy. Choices:
|
|
(list) Custom IPv6 Internet Service name. |
|
(list) Custom Internet Service6 group name. |
|
(list) Internet Service group name. |
|
(list) IPv6 Internet Service name. |
|
When enabled internet-service6 specifies what the service must NOT be. Choices:
|
|
Enable/disable use of IPv6 Internet Services in source for this policy. Choices:
|
|
(list) Custom IPv6 Internet Service source name. |
|
(list) Custom Internet Service6 source group name. |
|
(list) Internet Service6 source group name. |
|
(list) IPv6 Internet Service source name. |
|
When enabled internet-service6-src specifies what the service must NOT be. Choices:
|
|
(list or str) Custom Internet Service Name. |
|
(list or str) Custom Internet Service group name. |
|
(list or str) Internet Service group name. |
|
(list or str) Internet Service ID. |
|
(list or str) Internet Service name. |
|
When enabled internet-service specifies what the service must NOT be. Choices:
|
|
Enable/disable use of Internet Services in source for this policy. Choices:
|
|
(list or str) Custom Internet Service source name. |
|
(list or str) Custom Internet Service source group name. |
|
(list or str) Internet Service source group name. |
|
(list or str) Internet Service source ID. |
|
(list or str) Internet Service source name. |
|
When enabled internet-service-src specifies what the service must NOT be. Choices:
|
|
IP version of the policy. |
|
Enable to use IP Pools for source NAT. Choices:
|
|
Name of an existing IPS sensor. |
|
Name of an existing VoIP |
|
Label for the policy that appears when the GUI is in Section View mode. |
|
Enable to allow everything, but log all of the meaningful data for security information gathering. Choices:
|
|
Enable/disable HTTP transaction log. Choices:
|
|
Enable or disable logging. Choices:
|
|
Record logs when a session starts and ends. Choices:
|
|
Enable to match packets that have had their destination addresses changed by a VIP. Choices:
|
|
Enable/disable matching of only those packets that have had their destination addresses changed by a VIP. Choices:
|
|
Name of an existing MMS profile. |
|
Policy name. |
|
Enable/disable source NAT. Choices:
|
|
Enable/disable NAT46. Choices:
|
|
Enable/disable NAT64. Choices:
|
|
Policy-based IPsec VPN Choices:
|
|
Policy-based IPsec VPN |
|
Policy-based IPsec VPN Choices:
|
|
(list) Dynamic Network Service name. |
|
(list) Dynamic Network Service source name. |
|
Enable/disable UTM Network Processor acceleration. Choices:
|
|
Enable/disable UTM Network Processor acceleration. Choices:
|
|
Enable/disable NTLM authentication. Choices:
|
|
(list) HTTP-User-Agent value of supported browsers. |
|
Enable/disable NTLM guest user access. Choices:
|
|
Object position. |
|
Policy-based IPsec VPN Choices:
|
|
Enable/disable passive WAN health measurement. Choices:
|
|
Enable/disable PCP inbound DNAT. Choices:
|
|
Enable/disable PCP outbound SNAT. Choices:
|
|
(list) PCP pool names. |
|
Per-IP traffic shaper. |
|
Accept UDP packets from any host. Choices:
|
|
Accept UDP packets from any Session Traversal Utilities for NAT Choices:
|
|
PFCP profile. |
|
Behaviour of the policy. |
|
Enable/disable policy expiry. Choices:
|
|
Policy expiry date |
|
Policy expiry date and time, in epoch format. |
|
Enable/Disable hardware session setup for CGNAT. Choices:
|
|
Policy ID. |
|
(list or str) IP Pool names. |
|
(list or str) IPv6 pool names. |
|
Enable/disable preservation of the original source port from source NAT if it has not been used. Choices:
|
|
Name of profile group. |
|
Name of an existing Protocol options profile. |
|
Determine whether the firewall policy allows security profile groups or single profiles only. Choices:
|
|
Enable IP authentication bypass. Choices:
|
|
Enable MAC authentication bypass. Choices:
|
|
URL users are directed to after seeing and accepting the disclaimer or authenticating. |
|
Override the default replacement message group for this policy. |
|
Direction of the initial traffic for reputation to take effect. Choices:
|
|
Direction of the initial traffic for IPv6 reputation to take effect. Choices:
|
|
Minimum Reputation to take action. |
|
IPv6 Minimum Reputation to take action. |
|
Enable/disable RADIUS single sign-on Choices:
|
|
(list or str) Address names if this is an RTP NAT policy. |
|
Enable Real Time Protocol Choices:
|
|
Block or monitor connections to Botnet servers or disable Botnet scanning. Choices:
|
|
Schedule name. |
|
Enable to force current sessions to end when the schedule object times out. Choices:
|
|
Name of an existing SCTP filter profile. |
|
Enable to send a reply when a session is denied or blocked by a firewall policy. Choices:
|
|
(list or str) Service and service group names. |
|
When enabled service specifies what the service must NOT be. Choices:
|
|
(int or str) Session TTL in seconds for sessions accepted by this policy. |
|
(list) Security group tags. |
|
Enable/disable security group tags Choices:
|
|
Name of an existing Spam filter profile. |
|
(list or str) Vendor MAC source ID. |
|
(list or str) Source address and address group names. |
|
(list or str) Source IPv6 address name and address group names. |
|
When enabled srcaddr6 specifies what the source address must NOT be. Choices:
|
|
When enabled srcaddr specifies what the source address must NOT be. Choices:
|
|
(list or str) Incoming |
|
Name of an existing SSH filter profile. |
|
Redirect SSH traffic to matching transparent proxy policy. Choices:
|
|
Enable to copy decrypted SSL traffic to a FortiGate interface Choices:
|
|
(list or str) SSL mirror interface name. |
|
Name of an existing SSL SSH profile. |
|
Enable or disable this policy. Choices:
|
|
Names of object-tags applied to this policy. |
|
Receiver TCP maximum segment size |
|
Sender TCP maximum segment size |
|
Enable/disable creation of TCP session without SYN flag. Choices:
|
|
TCP timeout profile ID |
|
Enable/disable sending RST packets when TCP sessions expire. Choices:
|
|
ToS |
|
Non-zero bit positions are used for comparison while zero bit positions are ignored. |
|
Enable negated TOS match. Choices:
|
|
Traffic shaper. |
|
Reverse traffic shaper. |
|
UDP timeout profile ID |
|
(list or str) URL category ID list. |
|
(list or str) Names of individual users that can authenticate with this policy. |
|
Enable to add one or more security profiles Choices:
|
|
Universally Unique Identifier |
|
Name of an existing VideoFilter profile. |
|
Name of an existing virtual-patch profile. |
|
VLAN forward direction user priority |
|
VLAN reverse direction user priority |
|
Set VLAN filters. |
|
Name of an existing VoIP profile. |
|
Vpn dst node. |
|
Host. |
|
Seq. |
|
Subnet. |
|
Vpn src node. |
|
Host. |
|
Seq. |
|
Subnet. |
|
Policy-based IPsec VPN |
|
Name of an existing Web application firewall profile. |
|
Enable/disable WAN optimization. Choices:
|
|
WAN optimization auto-detection mode. Choices:
|
|
WAN optimization passive mode options. Choices:
|
|
WAN optimization peer. |
|
WAN optimization profile. |
|
Enable/disable forwarding traffic matching this policy to a configured WCCP server. Choices:
|
|
Enable/disable web cache. Choices:
|
|
Enable/disable web cache for HTTPS. Choices:
|
|
Name of an existing Web filter profile. |
|
Webproxy forward server name. |
|
Webproxy profile name. |
|
Enable/disable WiFi Single Sign On Choices:
|
|
Enable/disable zero trust device ownership. Choices:
|
|
(list or str) Source ztna-ems-tag names. |
|
(list) Source ztna-ems-tag-secondary names. |
|
(list or str) Source ztna-geo-tag names. |
|
Redirect ZTNA traffic to matching Access-Proxy proxy-policy. Choices:
|
|
Enable/disable zero trust access. Choices:
|
|
ZTNA tag matching logic. Choices:
|
|
The overridden method for the underlying Json RPC request. Choices:
|
|
The rc codes list with which the conditions to fail will be overriden. |
|
The rc codes list with which the conditions to succeed will be overriden. |
|
The directive to create, update or delete an object. Choices:
|
|
The adom to lock for FortiManager running in workspace mode, the value can be global and others including root. |
|
The maximum time in seconds to wait for other user to release the workspace lock. Default: |
Notes
Note
Starting in version 2.4.0, all input arguments are named using the underscore naming convention (snake_case). Please change the arguments such as “var-name” to “var_name”. Old argument names are still available yet you will receive deprecation warnings. You can ignore this warning by setting deprecation_warnings=False in ansible.cfg.
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
hosts: fortimanagers
connection: httpapi
vars:
ansible_httpapi_use_ssl: true
ansible_httpapi_validate_certs: false
ansible_httpapi_port: 443
tasks:
- name: Configure IPv4 policies.
fortinet.fortimanager.fmgr_pkg_firewall_policy:
bypass_validation: false
adom: ansible
pkg: ansible # package name
state: present
pkg_firewall_policy:
action: accept # <value in [deny, accept, ipsec, ...]>
comments: ansible-comment
dstaddr: all
dstintf: any
# name: ansible-test-policy
nat: disable
policyid: 1
schedule: always
service: ALL
srcaddr: all
srcintf: any
status: disable
- name: Gathering fortimanager facts
hosts: fortimanagers
gather_facts: false
connection: httpapi
vars:
ansible_httpapi_use_ssl: true
ansible_httpapi_validate_certs: false
ansible_httpapi_port: 443
tasks:
- name: Retrieve all the IPv4 policies
fortinet.fortimanager.fmgr_fact:
facts:
selector: "pkg_firewall_policy"
params:
adom: "ansible"
pkg: "ansible" # package name
policy: "your_value"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The result of the request. Returned: always |
|
The full url requested. Returned: always Sample: |
|
The status of api request. Returned: always Sample: |
|
The api response. Returned: always |
|
The descriptive message of the api response. Returned: always Sample: |
|
The information of the target system. Returned: always |
|
The status the request. Returned: always Sample: |
|
Warning if the parameters used in the playbook are not supported by the current FortiManager version. Returned: complex |