summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/windows/win_firewall_rule.py
blob: 0454b4f7e3e0b54ba79b401ef8c6c39949949329 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/env python

# (c) 2014, Timothy Vandenbrande <timothy.vandenbrande@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

ANSIBLE_METADATA = {'status': ['preview'],
                    'supported_by': 'community',
                    'version': '1.0'}

DOCUMENTATION = r'''
---
module: win_firewall_rule
version_added: "2.0"
author: Timothy Vandenbrande
short_description: Windows firewall automation
description:
    - allows you to create/remove/update firewall rules
options:
    enable:
        description:
            - is this firewall rule enabled or disabled
        default: true
        required: false
    state:
        description:
            - should this rule be added or removed
        default: "present"
        required: true
        choices: ['present', 'absent']
    name:
        description:
            - the rules name
        default: null
        required: true
    direction:
        description:
            - is this rule for inbound or outbound traffic
        default: null
        required: true
        choices: ['in', 'out']
    action:
        description:
            - what to do with the items this rule is for
        default: null
        required: true
        choices: ['allow', 'block', 'bypass']
    description:
        description:
            - description for the firewall rule
        default: null
        required: false
    localip:
        description:
            - the local ip address this rule applies to
        default: 'any'
        required: false
    remoteip:
        description:
            - the remote ip address/range this rule applies to
        default: 'any'
        required: false
    localport:
        description:
            - the local port this rule applies to
        default: 'any'
        required: false
    remoteport:
        description:
            - the remote port this rule applies to
        default: 'any'
        required: false
    program:
        description:
            - the program this rule applies to
        default: null
        required: false
    service:
        description:
            - the service this rule applies to
        default: 'any'
        required: false
    protocol:
        description:
            - the protocol this rule applies to
        default: 'any'
        required: false
    profile:
        description:
            - the profile this rule applies to, e.g. Domain,Private,Public
        default: 'any'
        required: false
    force:
        description:
            - Enforces the change if a rule with different values exists
        default: false
        required: false


'''

EXAMPLES = r'''
- 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

'''