Documentation

win_firewall_rule - Windows firewall automation

New in version 2.0.

Synopsis

  • allows you to create/remove/update firewall rules

Options

parameter required default choices comments
action
yes
  • allow
  • block
  • bypass
what to do with the items this rule is for
description
no
description for the firewall rule
direction
yes
  • in
  • out
is this rule for inbound or outbound traffic
enable
no True
is this firewall rule enabled or disabled
force
no
Enforces the change if a rule with different values exists
localip
no any
the local ip address this rule applies to
localport
no any
the local port this rule applies to
name
yes
the rules name
profile
no any
the profile this rule applies to, e.g. Domain,Private,Public
program
no
the program this rule applies to
protocol
no any
the protocol this rule applies to
remoteip
no any
the remote ip address/range this rule applies to
remoteport
no any
the remote port this rule applies to
service
no any
the service this rule applies to
state
yes present
  • present
  • absent
should this rule be added or removed

Examples

- name: Firewall rule to allow smtp on TCP port 25
  action: win_firewall_rule
  args:
      name: smtp
      enable: yes
      state: present
      localport: 25
      action: allow
      direction: In
      protocol: TCP

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Support

This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.