ansible.windows.win_firewall module – Enable or disable the Windows Firewall
Note
This module is part of the ansible.windows 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 ansible.windows
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: ansible.windows.win_firewall
.
New in ansible.windows 2.6.0
Synopsis
Enable or Disable Windows Firewall profiles.
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: |
|
Set state of firewall for given profile. Choices:
|
See Also
See also
- community.windows.win_firewall_rule
Windows firewall automation.
Examples
- name: Enable firewall for Domain, Public and Private profiles
ansible.windows.win_firewall:
state: enabled
profiles:
- Domain
- Private
- Public
tags: enable_firewall
- name: Disable Domain firewall
ansible.windows.win_firewall:
state: disabled
profiles:
- Domain
tags: disable_firewall
- name: Enable firewall for Domain profile and block outbound connections
ansible.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: |
|
Chosen profile. Returned: always Sample: |
|
Desired state of the given firewall profile(s). Returned: always Sample: |