Debian Codegraph @

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

raw
1 # Copyright (c) 2022 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: domain
6 short_description: Ensures the existence of a Windows domain
7 description:
8 - Ensure that the domain named by I(dns_domain_name) exists and is
9 reachable.
10 - If the domain is not reachable, the domain is created in a new forest on
11 the target Windows Server 2012+ host.
12 - This module may require subsequent use of the
13 M(ansible.windows.win_reboot) action if changes are made.
14 options:
15 create_dns_delegation:
16 description:
17 - Whether to create a DNS delegation that references the new DNS server
18 that you install along with the domain controller.
19 - Valid for Active Directory-integrated DNS only.
20 - The default is computed automatically based on the environment.
21 type: bool
22 database_path:
23 description:
24 - The path to a directory on a fixed disk of the Windows host where the
25 domain database will be created.
26 - If not set then the default path is C(%SYSTEMROOT%\NTDS).
27 type: path
28 dns_domain_name:
29 description:
30 - The DNS name of the domain which should exist and be reachable or
31 reside on the target Windows host.
32 type: str
33 required: true
34 domain_mode:
35 description:
36 - Specifies the domain functional level of the first domain in the
37 creation of a new forest.
38 - The domain functional level cannot be lower than the forest functional
39 level, but it can be higher.
40 - The default is automatically computed and set.
41 - Current known modes are C(Win2003), C(Win2008), C(Win2008R2),
42 C(Win2012), C(Win2012R2), C(WinThreshold), or C(Win2025).
43 type: str
44 domain_netbios_name:
45 description:
46 - The NetBIOS name for the root domain in the new forest.
47 - For NetBIOS names to be valid for use with this parameter they must be
48 single label names of 15 characters or less, if not it will fail.
49 - If this parameter is not set, then the default is automatically
50 computed from the value of the I(domain_name) parameter.
51 type: str
52 forest_mode:
53 description:
54 - Specifies the forest functional level for the new forest.
55 - The default forest functional level in Windows Server is typically the
56 same as the version you are running.
57 - Current known modes are C(Win2003), C(Win2008), C(Win2008R2),
58 C(Win2012), C(Win2012R2), C(WinThreshold), or C(Win2025).
59 type: str
60 install_dns:
61 description:
62 - Whether to install the DNS service when creating the domain
63 controller.
64 type: bool
65 default: true
66 log_path:
67 description:
68 - Specifies the fully qualified, non-UNC path to a directory on a fixed
69 disk of the local computer where the log file for this operation is
70 written.
71 - If not set then the default path is C(%SYSTEMROOT%\NTDS).
72 type: path
73 safe_mode_password:
74 description:
75 - Safe mode password for the domain controller.
76 type: str
77 required: true
78 sysvol_path:
79 description:
80 - The path to a directory on a fixed disk of the Windows host where the
81 Sysvol file will be created.
82 - If not set then the default path is C(%SYSTEMROOT%\SYSVOL).
83 type: path
84 notes:
85 - This module must be run on a Windows target host.
86 - If using I(reboot=true), multiple reboots may occur if the host required a
87 reboot before the domain promotion. Also ensure the fully qualified module
88 name is used in the task or the I(collections) keyword includes this
89 collection.
90 extends_documentation_fragment:
91 - ansible.builtin.action_common_attributes
92 - ansible.builtin.action_common_attributes.flow
93 - microsoft.ad.action_reboot
94 attributes:
95 check_mode:
96 support: full
97 diff_mode:
98 support: none
99 platform:
100 platforms:
101 - windows
102 action:
103 support: full
104 async:
105 support: partial
106 details: Supported for all scenarios except with I(reboot=True).
107 bypass_host_loop:
108 support: none
109 seealso:
110 - module: microsoft.ad.domain_child
111 - module: microsoft.ad.domain_controller
112 - module: microsoft.ad.group
113 - module: microsoft.ad.membership
114 - module: microsoft.ad.user
115 - module: microsoft.ad.computer
116 - ref: Migration guide <ansible_collections.microsoft.ad.docsite.guide_migration.migrated_modules.win_domain>
117 description: This module replaces C(ansible.windows.win_domain). See the migration guide for details.
118 - module: ansible.windows.win_domain
119 author:
120 - Matt Davis (@nitzmahone)
121 - Jordan Borean (@jborean93)
122
123 EXAMPLES: |
124 - name: Create new domain in a new forest on the target host and reboot
125 microsoft.ad.domain:
126 dns_domain_name: ansible.vagrant
127 safe_mode_password: password123!
128 reboot: true
129
130 - name: Create new Windows domain in a new forest with specific parameters and reboot in post task
131 microsoft.ad.domain:
132 create_dns_delegation: false
133 database_path: C:\Windows\NTDS
134 dns_domain_name: ansible.vagrant
135 domain_mode: Win2012R2
136 domain_netbios_name: ANSIBLE
137 forest_mode: Win2012R2
138 safe_mode_password: password123!
139 sysvol_path: C:\Windows\SYSVOL
140 register: domain_install
141
142 - name: Reboot host if install requires it
143 ansible.windows.win_reboot:
144 when: domain_install.reboot_required
145
146 RETURN:
147 reboot_required:
148 description: True if changes were made that require a reboot.
149 returned: always
150 type: bool
151 sample: true