Debian Codegraph @

ansible_collections/microsoft/ad/plugins/modules/group.yml

raw
1 # Copyright: (c) 2023, Ansible Project
2 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
3
4 DOCUMENTATION:
5 module: group
6 short_description: Manage Active Directory group objects
7 description:
8 - Manages Active Directory group objects and their attributes.
9 options:
10 category:
11 description:
12 - The category of the group.
13 - If a new group is created then C(security) will be used by default.
14 - A C(security) group can be associated with access control lists
15 whereas C(distribution) groups are typically associated with mailing
16 distribution lists.
17 - This is the value set on the C(groupType) LDAP attributes.
18 choices:
19 - distribution
20 - security
21 type: str
22 homepage:
23 description:
24 - The homepage of the group.
25 - This is the value set on the C(wWWHomePage) LDAP attribute.
26 type: str
27 managed_by:
28 description:
29 - The user or group that manages the group.
30 - The value can be in the form of a C(distinguishedName), C(objectGUID),
31 C(objectSid), C(sAMAccountName), or C(userPrincipalName) string or a
32 dictionary with the I(name) and optional I(server) key.
33 - This is the value set on the C(managedBy) LDAP attribute.
34 - See
35 R(DN Lookup Attributes,ansible_collections.microsoft.ad.docsite.guide_attributes.dn_lookup_attributes)
36 for more information on how DN lookups work.
37 type: raw
38 members:
39 description:
40 - The members of the group to set.
41 - The value is a dictionary that contains 3 keys, I(add), I(remove), and
42 I(set).
43 - Each subkey value is a list of values in the form of a
44 C(distinguishedName), C(objectGUID), C(objectSid), C(sAMAccountName),
45 or C(userPrincipalName) string or a dictionary with the I(name) and
46 optional I(server) key.
47 - The value for each subkey can either be specified as a string or a
48 dictionary with the I(name) and optional I(server) key. The I(name) is
49 the identity to lookup and I(server) is an optional key to override
50 what AD server to lookup the identity on.
51 - See
52 R(DN Lookup Attributes,ansible_collections.microsoft.ad.docsite.guide_attributes.dn_lookup_attributes)
53 for more information.
54 type: dict
55 suboptions:
56 add:
57 description:
58 - Adds the principals specified as members of the group, keeping the
59 existing membership if they are not specified.
60 type: list
61 elements: raw
62 lookup_failure_action:
63 description:
64 - Control the action to take when the lookup fails to find the DN.
65 - C(fail) will cause the task to fail.
66 - C(ignore) will ignore the value and continue.
67 - C(warn) will ignore the value and display a warning.
68 choices: ['fail', 'ignore', 'warn']
69 default: fail
70 type: str
71 remove:
72 description:
73 - Removes the principals specified as members of the group, keeping
74 the existing membership if they are not specified.
75 type: list
76 elements: raw
77 set:
78 description:
79 - Sets only the principals specified as members of the group.
80 - Any other existing member will be removed from the group
81 membership if not specified in this list.
82 - Set this to an empty list to remove all members from a group.
83 type: list
84 elements: raw
85 sam_account_name:
86 description:
87 - The C(sAMAccountName) value to set for the group.
88 - If omitted, the I(name) value is used when creating a new group.
89 type: str
90 scope:
91 description:
92 - The scope of the group.
93 - This is required when I(state=present) and the group does not already
94 exist.
95 - See
96 L(Group scope,https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc755692%28v=ws.10%29)
97 for more information on the various domain group scopes.
98 - This is the value set on the C(groupType) LDAP attributes.
99 choices:
100 - domainlocal
101 - global
102 - universal
103 type: str
104 notes:
105 - See R(win_group migration,ansible_collections.microsoft.ad.docsite.guide_migration.migrated_modules.win_domain_group)
106 for help on migrating from M(community.windows.win_domain_group) to this
107 module.
108 - This module must be run on a Windows target host with the
109 C(ActiveDirectory) module installed.
110 extends_documentation_fragment:
111 - microsoft.ad.ad_object
112 - ansible.builtin.action_common_attributes
113 attributes:
114 check_mode:
115 support: full
116 diff_mode:
117 support: full
118 platform:
119 platforms:
120 - windows
121 seealso:
122 - module: microsoft.ad.domain
123 - module: microsoft.ad.domain_controller
124 - module: microsoft.ad.membership
125 - module: microsoft.ad.object_info
126 - module: microsoft.ad.object
127 - module: microsoft.ad.user
128 - ref: Migration guide <ansible_collections.microsoft.ad.docsite.guide_migration.migrated_modules.win_domain_group>
129 description: This module replaces C(community.windows.win_domain_group). See the migration guide for details.
130 - module: community.windows.win_domain_group
131 author:
132 - Jordan Borean (@jborean93)
133
134 EXAMPLES: |
135 - name: Ensure a group exists
136 microsoft.ad.group:
137 identity: Cow
138 scope: global
139
140 - name: Remove a group
141 microsoft.ad.group:
142 identity: Cow
143 state: absent
144
145 - name: Create a group in a custom path
146 microsoft.ad.group:
147 name: Cow
148 scope: global
149 path: OU=groups,DC=ansible,DC=local
150 state: present
151
152 - name: Remove a group in a custom path
153 microsoft.ad.group:
154 name: Cow
155 path: OU=groups,DC=ansible,DC=local
156 state: absent
157
158 - name: Create group with delete protection enabled and custom attributes
159 microsoft.ad.group:
160 name: Ansible Users
161 scope: domainlocal
162 category: security
163 homepage: www.ansible.com
164 attributes:
165 set:
166 mail: [email protected]
167 protect_from_deletion: true
168
169 - name: Change the path of a group
170 microsoft.ad.group:
171 name: MyGroup
172 scope: global
173 identity: S-1-5-21-2171456218-3732823212-122182344-1189
174 path: OU=groups,DC=ansible,DC=local
175
176 - name: Add managed_by user
177 microsoft.ad.group:
178 name: Group Name Here
179 scope: global
180 managed_by: Domain Admins
181
182 - name: Add group and specify the AD domain services to use for the create
183 microsoft.ad.group:
184 name: Test Group
185 domain_username: [email protected]
186 domain_password: Password01!
187 domain_server: corp-DC12.corp.ansible.com
188 scope: domainlocal
189
190 - name: Add members to the group, preserving existing membership
191 microsoft.ad.group:
192 name: Test Group
193 scope: domainlocal
194 members:
195 add:
196 - Domain Admins
197 - Domain Users
198
199 - name: Remove members from the group, preserving existing membership
200 microsoft.ad.group:
201 name: Test Group
202 scope: domainlocal
203 members:
204 remove:
205 - Domain Admins
206 - Domain Users
207
208 - name: Replace entire membership of group
209 microsoft.ad.group:
210 name: Test Group
211 scope: domainlocal
212 members:
213 set:
214 - Domain Admins
215 - Domain Users
216 - name: UserInOtherDomain
217 server: OtherDomain
218 domain_credentials:
219 - name: OtherDomain
220 username: OtherDomainUser
221 password: '{{ other_domain_password }}'
222
223 RETURN:
224 object_guid:
225 description:
226 - The C(objectGUID) of the AD object that was created, removed, or edited.
227 - If a new object was created in check mode, a GUID of 0s will be
228 returned.
229 returned: always
230 type: str
231 sample: d84a141f-2b99-4f08-9da0-ed2d26864ba1
232 distinguished_name:
233 description:
234 - The C(distinguishedName) of the AD object that was created, removed, or
235 edited.
236 returned: always
237 type: str
238 sample: CN=MyGroup,CN=Users,,DC=domain,DC=test
239 sid:
240 description:
241 - The Security Identifier (SID) of the group managed.
242 - If a new group was created in check mode, the SID will be C(S-1-5-0000).
243 returned: always
244 type: str
245 sample: S-1-5-21-4151808797-3430561092-2843464588-1104