| 1 |
# -*- coding: utf-8 -*- |
| 2 |
|
| 3 |
# Copyright (c) 2023 Ansible Project |
| 4 |
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 5 |
|
| 6 |
|
| 7 |
class ModuleDocFragment: |
| 8 |
|
| 9 |
# Common options for ansible_collections.microsoft.ad.plugins.module_utils._ADObject |
| 10 |
DOCUMENTATION = r""" |
| 11 |
requirements: |
| 12 |
- C(ActiveDirectory) PowerShell module |
| 13 |
options: |
| 14 |
attributes: |
| 15 |
description: |
| 16 |
- The attributes to either add, remove, or set on the AD object. |
| 17 |
- The value of each attribute option should be a dictionary where the key |
| 18 |
is the LDAP attribute, e.g. C(firstName), C(comment) and the value is the |
| 19 |
value, or list of values, to set for that attribute. |
| 20 |
- The attribute value(s) can either be the raw string, integer, or bool |
| 21 |
value to add, remove, or set on the attribute in question. |
| 22 |
- The value can also be a dictionary with the I(type) key set to C(bytes), |
| 23 |
C(date_time), C(security_descriptor), or C(raw) and the value for this |
| 24 |
entry under the I(value) key. |
| 25 |
- The C(bytes) type has a value that is a base64 encoded string of the raw |
| 26 |
bytes to set. |
| 27 |
- The C(date_time) type has a value that is the ISO 8601 DateTime string of |
| 28 |
the DateTime to set. The DateTime will be set as the Microsoft FILETIME |
| 29 |
integer value which is the number of 100 nanoseconds since 1601-01-01 in |
| 30 |
UTC. |
| 31 |
- The C(security_descriptor) type has a value that is the Security |
| 32 |
Descriptor SDDL string used for the C(nTSecurityDescriptor) attribute. |
| 33 |
- The C(raw) type is the int, string, or boolean value to set. |
| 34 |
- String attribute values are compared using a case sensitive match on the |
| 35 |
AD object being managed. |
| 36 |
- See R(LDAP attributes help,ansible_collections.microsoft.ad.docsite.guide_attributes) |
| 37 |
for more information. |
| 38 |
default: {} |
| 39 |
type: dict |
| 40 |
suboptions: |
| 41 |
add: |
| 42 |
description: |
| 43 |
- A dictionary of all the attributes and their value(s) to add to the |
| 44 |
AD object being managed if they are not already present. |
| 45 |
- This is used for attributes that can contain multiple values, if the |
| 46 |
attribute only allows a single value, use I(set) instead. |
| 47 |
default: {} |
| 48 |
type: dict |
| 49 |
remove: |
| 50 |
description: |
| 51 |
- A dictionary of all the attributes and their value(s) to remove from |
| 52 |
the AD object being managed if they are present. |
| 53 |
- This is used for attributes that can contain multiple values, if the |
| 54 |
attribute only allows a single value, use I(set) instead. |
| 55 |
default: {} |
| 56 |
type: dict |
| 57 |
set: |
| 58 |
description: |
| 59 |
- A dictionary of all attributes and their value(s) to set on the AD |
| 60 |
object being managed. |
| 61 |
- This will replace any existing values if they do not match the ones |
| 62 |
being requested. |
| 63 |
- The order of attribute values are not checked only, only that the |
| 64 |
values requested are the only values on the object attribute. |
| 65 |
- Set this to null or an empty list to clear any values for the |
| 66 |
attribute. |
| 67 |
default: {} |
| 68 |
type: dict |
| 69 |
description: |
| 70 |
description: |
| 71 |
- The description of the AD object to set. |
| 72 |
- This is the value set on the C(description) LDAP attribute. |
| 73 |
type: str |
| 74 |
display_name: |
| 75 |
description: |
| 76 |
- The display name of the AD object to set. |
| 77 |
- This is the value of the C(displayName) LDAP attribute. |
| 78 |
type: str |
| 79 |
domain_credentials: |
| 80 |
description: |
| 81 |
- Specifies the credentials that should be used when using the server |
| 82 |
specified by I(name). |
| 83 |
- To specify credentials for the default domain server, use an entry |
| 84 |
without the I(name) key or use the I(domain_username) and |
| 85 |
I(domain_password) option. |
| 86 |
- This can be set under the R(play's module defaults,module_defaults_groups) |
| 87 |
under the C(group/microsoft.ad.domain) group. |
| 88 |
- See R(AD authentication in modules,ansible_collections.microsoft.ad.docsite.guide_ad_module_authentication) |
| 89 |
for more information. |
| 90 |
default: [] |
| 91 |
type: list |
| 92 |
elements: dict |
| 93 |
suboptions: |
| 94 |
name: |
| 95 |
description: |
| 96 |
- The name of the server these credentials are for. |
| 97 |
- This value should correspond to the value used in other options that |
| 98 |
specify a custom server to use, for example an option that references |
| 99 |
an AD identity located on a different AD server. |
| 100 |
- This key can be omitted in one entry to specify the default |
| 101 |
credentials to use when a server is not specified instead of using |
| 102 |
I(domain_username) and I(domain_password). |
| 103 |
type: str |
| 104 |
username: |
| 105 |
description: |
| 106 |
- The username to use when connecting to the server specified by |
| 107 |
I(name). |
| 108 |
type: str |
| 109 |
required: true |
| 110 |
password: |
| 111 |
description: |
| 112 |
- The password to use when connecting to the server specified by |
| 113 |
I(name). |
| 114 |
type: str |
| 115 |
required: true |
| 116 |
domain_password: |
| 117 |
description: |
| 118 |
- The password for I(domain_username). |
| 119 |
- The I(domain_credentials) sub entry without a I(name) key can also be |
| 120 |
used to specify the credentials for the default domain authentication. |
| 121 |
- This can be set under the R(play's module defaults,module_defaults_groups) |
| 122 |
under the C(group/microsoft.ad.domain) group. |
| 123 |
type: str |
| 124 |
domain_server: |
| 125 |
description: |
| 126 |
- Specified the Active Directory Domain Services instance to connect to. |
| 127 |
- Can be in the form of an FQDN or NetBIOS name. |
| 128 |
- If not specified then the value is based on the default domain of the computer running PowerShell. |
| 129 |
- Custom credentials can be specified under a I(domain_credentials) entry |
| 130 |
without a I(name) key or through I(domain_username) and |
| 131 |
I(domain_password). |
| 132 |
- This can be set under the R(play's module defaults,module_defaults_groups) |
| 133 |
under the C(group/microsoft.ad.domain) group. |
| 134 |
type: str |
| 135 |
domain_username: |
| 136 |
description: |
| 137 |
- The username to use when interacting with AD. |
| 138 |
- If this is not set then the user that is used for authentication will be the connection user. |
| 139 |
- Ansible will be unable to use the connection user unless auth is Kerberos with credential delegation or CredSSP, |
| 140 |
or become is used on the task. |
| 141 |
- The I(domain_credentials) sub entry without a I(name) key can also be |
| 142 |
used to specify the credentials for the default domain authentication. |
| 143 |
- This can be set under the R(play's module defaults,module_defaults_groups) |
| 144 |
under the C(group/microsoft.ad.domain) group. |
| 145 |
type: str |
| 146 |
identity: |
| 147 |
description: |
| 148 |
- The identity of the AD object used to find the AD object to manage. |
| 149 |
- This must be specified if; I(name) is not set, when trying to rename the |
| 150 |
object with a new I(name), or when trying to move the object into a |
| 151 |
different I(path). |
| 152 |
- The identity can be in the form of a GUID representing the C(objectGUID) |
| 153 |
value, the C(userPrincipalName), C(sAMAccountName), C(objectSid), or |
| 154 |
C(distinguishedName). |
| 155 |
- If omitted, the AD object to manage is selected by the |
| 156 |
C(distinguishedName) using the format C(CN={{ name }},{{ path }}). If |
| 157 |
I(path) is not defined, the C(defaultNamingContext) is used instead. |
| 158 |
- When using the M(microsoft.ad.computer) module, the identity will |
| 159 |
automatically append C($) to the end of the C(sAMAccountName) if the |
| 160 |
provided value did not result in a match and did not already have a C($) |
| 161 |
at the end. |
| 162 |
type: str |
| 163 |
name: |
| 164 |
description: |
| 165 |
- The C(name) of the AD object to manage, this is not the C(sAMAccountName) |
| 166 |
of the object but the LDAP C(cn) or C(name) entry of the object in the |
| 167 |
path specified. Use I(identity) to select an object to manage by its |
| 168 |
C(sAMAccountName). |
| 169 |
- If I(identity) is specified, and the name of the object found by that |
| 170 |
identity does not match this value, the object will be renamed. |
| 171 |
- This must be specified if I(identity) is not set. |
| 172 |
type: str |
| 173 |
path: |
| 174 |
description: |
| 175 |
- The path of the OU or the container where the new object should exist in. |
| 176 |
- If creating a new object, the new object will be created at the path |
| 177 |
specified. If no path is specified then the C(defaultNamingContext) of |
| 178 |
the domain will be used as the path for most object types. |
| 179 |
- If managing an existing object found by I(identity), the path of the |
| 180 |
found object will be moved to the one specified by this option. If no |
| 181 |
path is specified, the object will not be moved. |
| 182 |
- The modules M(microsoft.ad.computer), M(microsoft.ad.user), and |
| 183 |
M(microsoft.ad.group) have their own default path that is |
| 184 |
configured on the Active Directory domain controller. |
| 185 |
- This can be set to the literal value C(microsoft.ad.default_path) which |
| 186 |
will equal the default value used when creating a new object. |
| 187 |
type: str |
| 188 |
protect_from_deletion: |
| 189 |
description: |
| 190 |
- Marks the object as protected from accidental deletion. |
| 191 |
- This applies a deny access right from deleting the object normally and |
| 192 |
the protection needs to be removed before the object can be deleted |
| 193 |
through the GUI or any other tool outside Ansible. |
| 194 |
- Using I(state=absent) will still delete the AD object even if it is |
| 195 |
marked as protected from deletion. |
| 196 |
type: bool |
| 197 |
state: |
| 198 |
description: |
| 199 |
- Set to C(present) to ensure the AD object exists. |
| 200 |
- Set to C(absent) to remove the AD object if it exists. |
| 201 |
- The option I(name) must be set when I(state=present). |
| 202 |
- Using C(absent) will recursively remove the AD object and any child |
| 203 |
objects if it's a container. It will also remove the AD object even if |
| 204 |
the object is marked as protected from accidental deletion. |
| 205 |
choices: |
| 206 |
- absent |
| 207 |
- present |
| 208 |
default: present |
| 209 |
type: str |
| 210 |
notes: |
| 211 |
- Some LDAP attributes can have only a single value set while others can have |
| 212 |
multiple. Some attributes are also read only and cannot be changed. It is |
| 213 |
recommended to look at the schema metadata for an attribute where |
| 214 |
C(System-Only) are read only values and C(Is-Single-Value) are attributes |
| 215 |
with only 1 value. |
| 216 |
- Attempting to set multiple values to a C(Is-Single-Value) attribute results |
| 217 |
in undefined behaviour. |
| 218 |
- If running on a server that is not a Domain Controller, credential |
| 219 |
delegation through CredSSP or Kerberos with delegation must be used or the |
| 220 |
I(domain_username), I(domain_password) must be set. |
| 221 |
""" |