| 1 |
#!/usr/bin/python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
# Copyright: (c) 2018, Kevin Subileau (@ksubileau) |
| 5 |
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 6 |
|
| 7 |
DOCUMENTATION = r''' |
| 8 |
--- |
| 9 |
module: win_rds_cap |
| 10 |
short_description: Manage Connection Authorization Policies (CAP) on a Remote Desktop Gateway server |
| 11 |
description: |
| 12 |
- Creates, removes and configures a Remote Desktop connection authorization policy (RD CAP). |
| 13 |
- A RD CAP allows you to specify the users who can connect to a Remote Desktop Gateway server. |
| 14 |
author: |
| 15 |
- Kevin Subileau (@ksubileau) |
| 16 |
options: |
| 17 |
name: |
| 18 |
description: |
| 19 |
- Name of the connection authorization policy. |
| 20 |
type: str |
| 21 |
required: yes |
| 22 |
state: |
| 23 |
description: |
| 24 |
- The state of connection authorization policy. |
| 25 |
- If C(absent) will ensure the policy is removed. |
| 26 |
- If C(present) will ensure the policy is configured and exists. |
| 27 |
- If C(enabled) will ensure the policy is configured, exists and enabled. |
| 28 |
- If C(disabled) will ensure the policy is configured, exists, but disabled. |
| 29 |
type: str |
| 30 |
choices: [ absent, enabled, disabled, present ] |
| 31 |
default: present |
| 32 |
auth_method: |
| 33 |
description: |
| 34 |
- Specifies how the RD Gateway server authenticates users. |
| 35 |
- When a new CAP is created, the default value is C(password). |
| 36 |
type: str |
| 37 |
choices: [ both, none, password, smartcard ] |
| 38 |
order: |
| 39 |
description: |
| 40 |
- Evaluation order of the policy. |
| 41 |
- The CAP in which I(order) is set to a value of '1' is evaluated first. |
| 42 |
- By default, a newly created CAP will take the first position. |
| 43 |
- If the given value exceed the total number of existing policies, |
| 44 |
the policy will take the last position but the evaluation order |
| 45 |
will be capped to this number. |
| 46 |
type: int |
| 47 |
session_timeout: |
| 48 |
description: |
| 49 |
- The maximum time, in minutes, that a session can be idle. |
| 50 |
- A value of zero disables session timeout. |
| 51 |
type: int |
| 52 |
session_timeout_action: |
| 53 |
description: |
| 54 |
- The action the server takes when a session times out. |
| 55 |
- 'C(disconnect): disconnect the session.' |
| 56 |
- 'C(reauth): silently reauthenticate and reauthorize the session.' |
| 57 |
type: str |
| 58 |
choices: [ disconnect, reauth ] |
| 59 |
default: disconnect |
| 60 |
idle_timeout: |
| 61 |
description: |
| 62 |
- Specifies the time interval, in minutes, after which an idle session is disconnected. |
| 63 |
- A value of zero disables idle timeout. |
| 64 |
type: int |
| 65 |
allow_only_sdrts_servers: |
| 66 |
description: |
| 67 |
- Specifies whether connections are allowed only to Remote Desktop Session Host servers that |
| 68 |
enforce Remote Desktop Gateway redirection policy. |
| 69 |
type: bool |
| 70 |
user_groups: |
| 71 |
description: |
| 72 |
- A list of user groups that is allowed to connect to the Remote Gateway server. |
| 73 |
- Required when a new CAP is created. |
| 74 |
type: list |
| 75 |
elements: str |
| 76 |
computer_groups: |
| 77 |
description: |
| 78 |
- A list of computer groups that is allowed to connect to the Remote Gateway server. |
| 79 |
type: list |
| 80 |
elements: str |
| 81 |
redirect_clipboard: |
| 82 |
description: |
| 83 |
- Allow clipboard redirection. |
| 84 |
type: bool |
| 85 |
redirect_drives: |
| 86 |
description: |
| 87 |
- Allow disk drive redirection. |
| 88 |
type: bool |
| 89 |
redirect_printers: |
| 90 |
description: |
| 91 |
- Allow printers redirection. |
| 92 |
type: bool |
| 93 |
redirect_serial: |
| 94 |
description: |
| 95 |
- Allow serial port redirection. |
| 96 |
type: bool |
| 97 |
redirect_pnp: |
| 98 |
description: |
| 99 |
- Allow Plug and Play devices redirection. |
| 100 |
type: bool |
| 101 |
requirements: |
| 102 |
- Windows Server 2008R2 (6.1) or higher. |
| 103 |
- The Windows Feature "RDS-Gateway" must be enabled. |
| 104 |
seealso: |
| 105 |
- module: community.windows.win_rds_cap |
| 106 |
- module: community.windows.win_rds_rap |
| 107 |
- module: community.windows.win_rds_settings |
| 108 |
''' |
| 109 |
|
| 110 |
EXAMPLES = r''' |
| 111 |
- name: Create a new RDS CAP with a 30 minutes timeout and clipboard redirection enabled |
| 112 |
community.windows.win_rds_cap: |
| 113 |
name: My CAP |
| 114 |
user_groups: |
| 115 |
- BUILTIN\users |
| 116 |
session_timeout: 30 |
| 117 |
session_timeout_action: disconnect |
| 118 |
allow_only_sdrts_servers: true |
| 119 |
redirect_clipboard: true |
| 120 |
redirect_drives: false |
| 121 |
redirect_printers: false |
| 122 |
redirect_serial: false |
| 123 |
redirect_pnp: false |
| 124 |
state: enabled |
| 125 |
''' |
| 126 |
|
| 127 |
RETURN = r''' |
| 128 |
''' |