.. _ansible.posix.firewalld_module:
***********************
ansible.posix.firewalld
***********************
**Manage arbitrary ports/services with firewalld**
.. contents::
:local:
:depth: 1
Synopsis
--------
- This module allows for addition or deletion of services and ports (either TCP or UDP) in either running or permanent firewalld rules.
Requirements
------------
The below requirements are needed on the host that executes this module.
- firewalld >= 0.2.11
Parameters
----------
.. raw:: html
Parameter |
Choices/Defaults |
Comments |
icmp_block
string
|
|
The ICMP block you would like to add/remove to/from a zone in firewalld.
|
icmp_block_inversion
string
|
|
Enable/Disable inversion of ICMP blocks for a zone in firewalld.
|
immediate
boolean
|
|
Should this configuration be applied immediately, if set as permanent.
|
interface
string
|
|
The interface you would like to add/remove to/from a zone in firewalld.
|
masquerade
string
|
|
The masquerade setting you would like to enable/disable to/from zones within firewalld.
|
offline
boolean
|
|
Whether to run this module even when firewalld is offline.
|
permanent
boolean
|
|
Should this configuration be in the running firewalld configuration or persist across reboots.
As of Ansible 2.3, permanent operations can operate on firewalld configs when it is not running (requires firewalld >= 0.3.9).
Note that if this is no , immediate is assumed yes .
|
port
string
|
|
Name of a port or port range to add/remove to/from firewalld.
Must be in the form PORT/PROTOCOL or PORT-PORT/PROTOCOL for port ranges.
|
port_forward
list
/ elements=dictionary
|
|
Port and protocol to forward using firewalld.
|
|
port
string
/ required
|
|
Source port to forward from
|
|
proto
string
/ required
|
|
protocol to forward
|
|
toaddr
string
|
|
Optional address to forward to
|
|
toport
string
/ required
|
|
destination port
|
rich_rule
string
|
|
Rich rule to add/remove to/from firewalld.
|
service
string
|
|
Name of a service to add/remove to/from firewalld.
The service must be listed in output of firewall-cmd --get-services.
|
source
string
|
|
The source/network you would like to add/remove to/from firewalld.
|
state
string
/ required
|
Choices:
- absent
- disabled
- enabled
- present
|
Enable or disable a setting.
For ports: Should this port accept (enabled) or reject (disabled) connections.
The states present and absent can only be used in zone level operations (i.e. when no other parameters but zone and state are set).
|
target
string
added in 1.2.0
|
Choices:
- default
- ACCEPT
- DROP
- %%REJECT%%
|
firewalld Zone target
If state is set to absent , this will reset the target to default
|
timeout
integer
|
Default:
0
|
The amount of time in seconds the rule should be in effect for when non-permanent.
|
zone
string
|
|
The firewalld zone to add/remove to/from.
Note that the default zone can be configured per system but public is default from upstream.
Available choices can be extended based on per-system configs, listed here are "out of the box" defaults.
Possible values include block , dmz , drop , external , home , internal , public , trusted , work .
|