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
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
    • yes
    • no
    is this firewall rule enabled or disabled
    force
    no
      Enforces the change if a rule with different values exists
      localip
      no
        the local ip address this rule applies to
        localport
        no
          the local port this rule applies to
          name
          yes
            the rules name
            profile
            no
              the profile this rule applies to
              program
              no
                the program this rule applies to
                protocol
                no
                  the protocol this rule applies to
                  remoteip
                  no
                    the remote ip address/range this rule applies to
                    remoteport
                    no
                      the remote port this rule applies to
                      service
                      no
                        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, Helping Testing PRs and Developing Modules.