1#!/usr/local/bin/python3.8
2# -*- coding: utf-8 -*-
3
4# Copyright: (c) 2017, Michael Eaton <meaton@iforium.com>
5# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7DOCUMENTATION = r'''
8---
9module: win_firewall
10short_description: Enable or disable the Windows Firewall
11description:
12- Enable or Disable Windows Firewall profiles.
13requirements:
14  - This module requires Windows Management Framework 5 or later.
15options:
16  profiles:
17    description:
18    - Specify one or more profiles to change.
19    type: list
20    choices: [ Domain, Private, Public ]
21    default: [ Domain, Private, Public ]
22  state:
23    description:
24    - Set state of firewall for given profile.
25    type: str
26    choices: [ disabled, enabled ]
27  inbound_action:
28    description:
29    - Set to C(allow) or C(block) inbound network traffic in the profile.
30    - C(not_configured) is valid when configuring a GPO.
31    type: str
32    choices: [ allow, block, not_configured ]
33    version_added: 1.1.0
34  outbound_action:
35    description:
36    - Set to C(allow) or C(block) inbound network traffic in the profile.
37    - C(not_configured) is valid when configuring a GPO.
38    type: str
39    choices: [ allow, block, not_configured ]
40    version_added: 1.1.0
41seealso:
42- module: community.windows.win_firewall_rule
43author:
44- Michael Eaton (@michaeldeaton)
45'''
46
47EXAMPLES = r'''
48- name: Enable firewall for Domain, Public and Private profiles
49  community.windows.win_firewall:
50    state: enabled
51    profiles:
52    - Domain
53    - Private
54    - Public
55  tags: enable_firewall
56
57- name: Disable Domain firewall
58  community.windows.win_firewall:
59    state: disabled
60    profiles:
61    - Domain
62  tags: disable_firewall
63
64- name: Enable firewall for Domain profile and block outbound connections
65  community.windows.win_firewall:
66    profiles: Domain
67    state: enabled
68    outbound_action: block
69  tags: block_connection
70'''
71
72RETURN = r'''
73enabled:
74    description: Current firewall status for chosen profile (after any potential change).
75    returned: always
76    type: bool
77    sample: true
78profiles:
79    description: Chosen profile.
80    returned: always
81    type: str
82    sample: Domain
83state:
84    description: Desired state of the given firewall profile(s).
85    returned: always
86    type: list
87    sample: enabled
88'''
89