win_firewall_rule - Windows firewall automation
New in version 2.0.
Synopsis
- Allows you to create/remove/update firewall rules.
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
action required |
| What to do with the items this rule is for. |
description | Description for the firewall rule. | |
direction required |
| Is this rule for inbound or outbound traffic. |
enabled bool |
| Is this firewall rule enabled or disabled. aliases: enable |
force bool |
| Replace any existing rule by removing it first. This is no longer required in 2.4 as rules no longer need replacing when being modified. DEPRECATED in 2.4 and will be removed in 2.9. |
localip | Default: "any" | The local ip address this rule applies to. |
localport | The local port this rule applies to. | |
name required | The rules name | |
profiles | Default: "domain,private,public" | The profile this rule applies to. aliases: profile |
program | The program this rule applies to. | |
protocol | Default: "any" | The protocol this rule applies to. |
remoteip | Default: "any" | The remote ip address/range this rule applies to. |
remoteport | The remote port this rule applies to. | |
service | The service this rule applies to. | |
state |
| Should this rule be added or removed. |
Examples
- name: Firewall rule to allow SMTP on TCP port 25 win_firewall_rule: name: SMTP localport: 25 action: allow direction: in protocol: tcp state: present enabled: yes - name: Firewall rule to allow RDP on TCP port 3389 win_firewall_rule: name: Remote Desktop localport: 3389 action: allow direction: in protocol: tcp profiles: private state: present enabled: yes
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author
- Artem Zinenko (@ar7z1)
- Timothy Vandenbrande (@TimothyVandenbrande)
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.6/modules/win_firewall_rule_module.html