Debian Codegraph @

test/support/windows-integration/plugins/modules/win_user_right.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # Copyright: (c) 2017, Ansible Project
5 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 # this is a windows documentation stub. actual code lives in the .ps1
8 # file of the same name
9
10 ANSIBLE_METADATA = {'metadata_version': '1.1',
11 'status': ['preview'],
12 'supported_by': 'community'}
13
14 DOCUMENTATION = r"""
15 ---
16 module: win_user_right
17 version_added: '2.4'
18 short_description: Manage Windows User Rights
19 description:
20 - Add, remove or set User Rights for a group or users or groups.
21 - You can set user rights for both local and domain accounts.
22 options:
23 name:
24 description:
25 - The name of the User Right as shown by the C(Constant Name) value from
26 U(https://technet.microsoft.com/en-us/library/dd349804.aspx).
27 - The module will return an error if the right is invalid.
28 type: str
29 required: yes
30 users:
31 description:
32 - A list of users or groups to add/remove on the User Right.
33 - These can be in the form DOMAIN\user-group, [email protected] for
34 domain users/groups.
35 - For local users/groups it can be in the form user-group, .\user-group,
36 SERVERNAME\user-group where SERVERNAME is the name of the remote server.
37 - You can also add special local accounts like SYSTEM and others.
38 - Can be set to an empty list with I(action=set) to remove all accounts
39 from the right.
40 type: list
41 required: yes
42 action:
43 description:
44 - C(add) will add the users/groups to the existing right.
45 - C(remove) will remove the users/groups from the existing right.
46 - C(set) will replace the users/groups of the existing right.
47 type: str
48 default: set
49 choices: [ add, remove, set ]
50 notes:
51 - If the server is domain joined this module can change a right but if a GPO
52 governs this right then the changes won't last.
53 seealso:
54 - module: win_group
55 - module: win_group_membership
56 - module: win_user
57 author:
58 - Jordan Borean (@jborean93)
59 """
60
61 EXAMPLES = r"""
62 ---
63 - name: Replace the entries of Deny log on locally
64 win_user_right:
65 name: SeDenyInteractiveLogonRight
66 users:
67 - Guest
68 - Users
69 action: set
70
71 - name: Add account to Log on as a service
72 win_user_right:
73 name: SeServiceLogonRight
74 users:
75 - .\Administrator
76 - '{{ansible_hostname}}\local-user'
77 action: add
78
79 - name: Remove accounts who can create Symbolic links
80 win_user_right:
81 name: SeCreateSymbolicLinkPrivilege
82 users:
83 - SYSTEM
84 - Administrators
85 - DOMAIN\User
86 - [email protected]
87 action: remove
88
89 - name: Remove all accounts who cannot log on remote interactively
90 win_user_right:
91 name: SeDenyRemoteInteractiveLogonRight
92 users: []
93 """
94
95 RETURN = r"""
96 added:
97 description: A list of accounts that were added to the right, this is empty
98 if no accounts were added.
99 returned: success
100 type: list
101 sample: ["NT AUTHORITY\\SYSTEM", "DOMAIN\\User"]
102 removed:
103 description: A list of accounts that were removed from the right, this is
104 empty if no accounts were removed.
105 returned: success
106 type: list
107 sample: ["SERVERNAME\\Administrator", "BUILTIN\\Administrators"]
108 """