W3cubDocs

/Ansible

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 trafic
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

This is an Extras Module

For more information on what this means please read Extras Modules

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

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/win_firewall_rule_module.html