Documentation
PLEASE NOTE: This document applies to latest version and not to the latest stable release v2.21
Documentation for other releases can be found by using the version selector in the top right of any doc page.firewalld
Manage firewall rules using firewalld.
Attributes
check_mode:
support: full
Parameters
| Parameter | Required | Type | Values | Description |
|---|---|---|---|---|
| zone | string | Firewall zone to operate on. [default: default from system] |
||
| service | string | Service to allow or block (e.g., http, https, ssh). | ||
| port | string | Port to allow or block (e.g., 8080/tcp, 53/udp). | ||
| state | true | string | enabled disabled |
Whether the rule should be enabled or disabled. |
| permanent | boolean | Make the change permanent (survive reboots). [default: false] |
||
| immediate | boolean | Apply the change immediately without requiring a reload. [default: false] |
Examples
- name: Allow HTTP traffic
firewalld:
service: http
zone: public
state: enabled
permanent: true
immediate: true
- name: Allow port 8080/tcp
firewalld:
port: 8080/tcp
zone: public
state: enabled
permanent: true
- name: Block HTTPS traffic
firewalld:
service: https
zone: public
state: disabled
permanent: true
immediate: true
- name: Allow port range
firewalld:
port: 8000-8005/tcp
zone: public
state: enabled
permanent: true