community.windows.win_firewall module – Enable or disable the Windows Firewall
Note
This module is part of the community.windows collection (version 1.10.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 community.windows
.
To use it in a playbook, specify: community.windows.win_firewall
.
Requirements
The below requirements are needed on the host that executes this module.
This module requires Windows Management Framework 5 or later.
Parameters
Parameter |
Comments |
---|---|
Set to
Choices:
|
|
Set to
Choices:
|
|
Specify one or more profiles to change. Choices:
Default: [“Domain”, “Private”, “Public”] |
|
Set state of firewall for given profile. Choices:
|
See Also
See also
- community.windows.win_firewall_rule
The official documentation on the community.windows.win_firewall_rule module.
Examples
- name: Enable firewall for Domain, Public and Private profiles
community.windows.win_firewall:
state: enabled
profiles:
- Domain
- Private
- Public
tags: enable_firewall
- name: Disable Domain firewall
community.windows.win_firewall:
state: disabled
profiles:
- Domain
tags: disable_firewall
- name: Enable firewall for Domain profile and block outbound connections
community.windows.win_firewall:
profiles: Domain
state: enabled
outbound_action: block
tags: block_connection
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Current firewall status for chosen profile (after any potential change). Returned: always Sample: true |
|
Chosen profile. Returned: always Sample: “Domain” |
|
Desired state of the given firewall profile(s). Returned: always Sample: “enabled” |
Authors
Michael Eaton (@michaeldeaton)