2015-03-16 11:34:07 +01:00
|
|
|
#!/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/>.
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
---
|
2015-10-06 11:47:27 +02:00
|
|
|
module: win_firewall_rule
|
2015-07-02 10:00:33 +02:00
|
|
|
version_added: "2.0"
|
2015-03-16 11:34:07 +01:00
|
|
|
author: Timothy Vandenbrande
|
|
|
|
short_description: Windows firewall automation
|
|
|
|
description:
|
|
|
|
- allows you to create/remove/update firewall rules
|
2015-10-06 15:03:27 +02:00
|
|
|
options:
|
|
|
|
enable:
|
|
|
|
description:
|
|
|
|
- is this firewall rule enabled or disabled
|
|
|
|
default: null
|
|
|
|
required: false
|
|
|
|
choices: ['yes', 'no']
|
2015-03-16 11:34:07 +01:00
|
|
|
state:
|
|
|
|
description:
|
2016-03-10 14:56:36 +01:00
|
|
|
- should this rule be added or removed
|
2015-03-16 11:34:07 +01:00
|
|
|
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 trafic
|
|
|
|
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' ]
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- description for the firewall rule
|
|
|
|
default: null
|
|
|
|
required: false
|
|
|
|
localip:
|
|
|
|
description:
|
|
|
|
- the local ip address this rule applies to
|
|
|
|
default: null
|
|
|
|
required: false
|
|
|
|
remoteip:
|
|
|
|
description:
|
|
|
|
- the remote ip address/range this rule applies to
|
|
|
|
default: null
|
|
|
|
required: false
|
|
|
|
localport:
|
|
|
|
description:
|
|
|
|
- the local port this rule applies to
|
|
|
|
default: null
|
|
|
|
required: false
|
|
|
|
remoteport:
|
|
|
|
description:
|
|
|
|
- the remote port this rule applies to
|
|
|
|
default: null
|
|
|
|
required: false
|
|
|
|
program:
|
|
|
|
description:
|
|
|
|
- the program this rule applies to
|
|
|
|
default: null
|
|
|
|
required: false
|
|
|
|
service:
|
|
|
|
description:
|
|
|
|
- the service this rule applies to
|
|
|
|
default: null
|
|
|
|
required: false
|
|
|
|
protocol:
|
|
|
|
description:
|
|
|
|
- the protocol this rule applies to
|
|
|
|
default: null
|
|
|
|
required: false
|
2015-06-30 08:39:19 +02:00
|
|
|
profile:
|
2015-10-05 22:53:11 +02:00
|
|
|
description:
|
2015-06-30 08:39:19 +02:00
|
|
|
- the profile this rule applies to
|
2015-10-05 22:53:11 +02:00
|
|
|
default: null
|
|
|
|
required: false
|
2015-03-16 11:34:07 +01:00
|
|
|
force:
|
|
|
|
description:
|
|
|
|
- Enforces the change if a rule with different values exists
|
|
|
|
default: false
|
|
|
|
required: false
|
2015-10-06 11:47:27 +02:00
|
|
|
|
2015-03-16 11:34:07 +01:00
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
2015-10-06 11:47:27 +02:00
|
|
|
- name: Firewall rule to allow smtp on TCP port 25
|
|
|
|
action: win_firewall_rule
|
2015-03-16 11:34:07 +01:00
|
|
|
args:
|
|
|
|
name: smtp
|
2015-10-06 15:03:27 +02:00
|
|
|
enabled: yes
|
2015-03-16 11:34:07 +01:00
|
|
|
state: present
|
|
|
|
localport: 25
|
|
|
|
action: allow
|
|
|
|
protocol: TCP
|
|
|
|
|
2015-06-30 08:39:19 +02:00
|
|
|
'''
|