| 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: ou |
| 6 |
short_description: Manage Active Directory organizational units |
| 7 |
description: |
| 8 |
- Manages Active Directory organizational units and their attributes. |
| 9 |
options: |
| 10 |
city: |
| 11 |
description: |
| 12 |
- Configures the user's city. |
| 13 |
- This is the value set on the C(l) LDAP attribute. |
| 14 |
type: str |
| 15 |
country: |
| 16 |
description: |
| 17 |
- Configures the user's country code. |
| 18 |
- Note that this is a two-character ISO 3166 code. |
| 19 |
- This is the value set on the C(c) LDAP attribute. |
| 20 |
type: str |
| 21 |
managed_by: |
| 22 |
description: |
| 23 |
- The user or group that manages the object. |
| 24 |
- The value can be in the form of a C(distinguishedName), C(objectGUID), |
| 25 |
C(objectSid), C(sAMAccountName), or C(userPrincipalName) string or a |
| 26 |
dictionary with the I(name) and optional I(server) key. |
| 27 |
- This is the value set on the C(managedBy) LDAP attribute. |
| 28 |
- See |
| 29 |
R(DN Lookup Attributes,ansible_collections.microsoft.ad.docsite.guide_attributes.dn_lookup_attributes) |
| 30 |
for more information on how DN lookups work. |
| 31 |
type: raw |
| 32 |
postal_code: |
| 33 |
description: |
| 34 |
- Configures the user's postal code / zip code. |
| 35 |
- This is the value set on the C(postalcode) LDAP attribute. |
| 36 |
type: str |
| 37 |
state_province: |
| 38 |
description: |
| 39 |
- Configures the user's state. |
| 40 |
- This is the value set on the C(state) LDAP attribute. |
| 41 |
type: str |
| 42 |
street: |
| 43 |
description: |
| 44 |
- Configures the user's street address. |
| 45 |
- This is the value set on the C(street) LDAP attribute. |
| 46 |
type: str |
| 47 |
notes: |
| 48 |
- When an OU is created, I(protect_from_deletion) defaults to C(True) if not |
| 49 |
specified. |
| 50 |
- See |
| 51 |
R(win_domain_ou migration,ansible_collections.microsoft.ad.docsite.guide_migration.migrated_modules.win_domain_ou) |
| 52 |
for help on migrating from M(community.windows.win_domain_ou) to this |
| 53 |
module. |
| 54 |
- This module must be run on a Windows target host with the |
| 55 |
C(ActiveDirectory) module installed. |
| 56 |
extends_documentation_fragment: |
| 57 |
- microsoft.ad.ad_object |
| 58 |
- ansible.builtin.action_common_attributes |
| 59 |
attributes: |
| 60 |
check_mode: |
| 61 |
support: full |
| 62 |
diff_mode: |
| 63 |
support: full |
| 64 |
platform: |
| 65 |
platforms: |
| 66 |
- windows |
| 67 |
seealso: |
| 68 |
- module: microsoft.ad.domain |
| 69 |
- module: microsoft.ad.domain_controller |
| 70 |
- module: microsoft.ad.group |
| 71 |
- module: microsoft.ad.object_info |
| 72 |
- module: microsoft.ad.user |
| 73 |
- module: microsoft.ad.computer |
| 74 |
- ref: Migration guide <ansible_collections.microsoft.ad.docsite.guide_migration.migrated_modules.win_domain_ou> |
| 75 |
description: This module replaces C(community.windows.win_domain_ou). See the migration guide for details. |
| 76 |
- module: community.windows.win_domain_ou |
| 77 |
author: |
| 78 |
- Jordan Borean (@jborean93) |
| 79 |
|
| 80 |
EXAMPLES: | |
| 81 |
- name: Ensure OU is present & protected |
| 82 |
microsoft.ad.ou: |
| 83 |
name: AnsibleFest |
| 84 |
state: present |
| 85 |
|
| 86 |
- name: Ensure OU is present & protected |
| 87 |
microsoft.ad.ou: |
| 88 |
name: EUC Users |
| 89 |
path: DC=euc,DC=vmware,DC=lan |
| 90 |
state: present |
| 91 |
protect_from_deletion: true |
| 92 |
|
| 93 |
- name: Ensure OU is absent |
| 94 |
microsoft.ad.ou: |
| 95 |
name: EUC Users |
| 96 |
path: DC=euc,DC=vmware,DC=lan |
| 97 |
state: absent |
| 98 |
|
| 99 |
- name: Ensure OU is present with specific properties |
| 100 |
microsoft.ad.ou: |
| 101 |
name: WS1Users |
| 102 |
path: CN=EUC Users,DC=euc,DC=vmware,DC=lan |
| 103 |
protect_from_deletion: true |
| 104 |
description: EUC Business Unit |
| 105 |
city: Sandy Springs |
| 106 |
country: US |
| 107 |
state_province: Georgia |
| 108 |
street: 1155 Perimeter Center West |
| 109 |
postal_code: 30189 |
| 110 |
|
| 111 |
- name: Ensure OU updated with new properties |
| 112 |
microsoft.ad.ou: |
| 113 |
name: WS1Users |
| 114 |
path: DC=euc,DC=vmware,DC=lan |
| 115 |
protected: false |
| 116 |
managed_by: [email protected] |
| 117 |
attributes: |
| 118 |
set: |
| 119 |
comment: A comment for the OU |
| 120 |
|
| 121 |
- name: Set managedBy using an identity from another DC |
| 122 |
microsoft.ad.ou: |
| 123 |
name: MyOU |
| 124 |
managed_by: |
| 125 |
name: manager-user |
| 126 |
server: OtherDC |
| 127 |
|
| 128 |
RETURN: |
| 129 |
object_guid: |
| 130 |
description: |
| 131 |
- The C(objectGUID) of the AD object that was created, removed, or edited. |
| 132 |
- If a new object was created in check mode, a GUID of 0s will be |
| 133 |
returned. |
| 134 |
returned: always |
| 135 |
type: str |
| 136 |
sample: d84a141f-2b99-4f08-9da0-ed2d26864ba1 |
| 137 |
distinguished_name: |
| 138 |
description: |
| 139 |
- The C(distinguishedName) of the AD object that was created, removed, or |
| 140 |
edited. |
| 141 |
returned: always |
| 142 |
type: str |
| 143 |
sample: CN=TestUser,CN=Users,DC=domain,DC=test |