Debian Codegraph @

ansible_collections/microsoft/ad/plugins/modules/domain_controller.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_controller
6 short_description: Manage domain controller/member server state for a Windows host
7 description:
8 - Ensure that a Windows Server 2012+ host is configured as a domain
9 controller or demoted to member server.
10 - This module may require subsequent use of the
11 M(ansible.windows.win_reboot) action if changes are made.
12 options:
13 database_path:
14 description:
15 - The path to a directory on a fixed disk of the Windows host where the
16 domain database will be created..
17 - If not set then the default path is C(%SYSTEMROOT%\NTDS).
18 type: path
19 dns_domain_name:
20 description:
21 - When I(state=domain_controller), the DNS name of the domain for which
22 the targeted Windows host should be a DC.
23 type: str
24 domain_admin_user:
25 description:
26 - Username of a domain admin for the target domain (necessary to promote
27 or demote a domain controller).
28 type: str
29 required: true
30 domain_admin_password:
31 description:
32 - Password for the specified I(domain_admin_user).
33 type: str
34 required: true
35 domain_log_path:
36 description:
37 - Specified the fully qualified, non-UNC path to a directory on a fixed
38 disk of the local computer that will contain the domain log files.
39 type: path
40 install_dns:
41 description:
42 - Whether to install the DNS service when creating the domain
43 controller.
44 - If not specified then the C(-InstallDns) option is not supplied to
45 C(Install-ADDSDomainController) command, see
46 L(Install-ADDSDomainController,https://learn.microsoft.com/en-us/powershell/module/addsdeployment/install-addsdomaincontroller).
47 type: bool
48 install_media_path:
49 description:
50 - The path to a directory on a fixed disk of the Windows host where the
51 Install From Media C(IFC) data will be used.
52 # yamllint disable rule:line-length
53 - See the
54 L(Install using IFM guide,https://social.technet.microsoft.com/wiki/contents/articles/8630.active-directory-step-by-step-guide-to-install-an-additional-domain-controller-using-ifm.aspx)
55 for more information.
56 # yamllint enable rule:line-length
57 type: path
58 local_admin_password:
59 description:
60 - Password to be assigned to the local C(Administrator) user (required
61 when I(state=member_server)).
62 type: str
63 read_only:
64 description:
65 - Whether to install the domain controller as a read only replica for an
66 existing domain.
67 type: bool
68 default: false
69 replication_source_dc:
70 description:
71 - Specifies the name of an existing domain controller in the forest that
72 will be used as the replication source for the new domain controller.
73 type: str
74 version_added: 1.8.0
75 safe_mode_password:
76 description:
77 - Safe mode password for the domain controller (required when
78 I(state=domain_controller)).
79 type: str
80 site_name:
81 description:
82 - Specifies the name of an existing site where you can place the new
83 domain controller.
84 - This option is required when I(read_only=true).
85 type: str
86 state:
87 description:
88 - Whether the target host should be a domain controller or a member
89 server.
90 type: str
91 choices:
92 - domain_controller
93 - member_server
94 required: true
95 sysvol_path:
96 description:
97 - The path to a directory on a fixed disk of the Windows host where the
98 Sysvol folder will be created.
99 - If not set then the default path is C(%SYSTEMROOT%\SYSVOL).
100 type: path
101 notes:
102 - It is highly recommended to set I(reboot=true) to have Ansible manage the
103 host reboot phase as the actions done by this module puts the host in a
104 state where it may not be possible for Ansible to reconnect in a
105 subsequent task without a reboot.
106 - This module must be run on a Windows target host.
107 - If using I(reboot=true), multiple reboots may occur if the host required a
108 reboot before the domain promotion. Also ensure the fully qualified module
109 name is used in the task or the I(collections) keyword includes this
110 collection.
111 extends_documentation_fragment:
112 - ansible.builtin.action_common_attributes
113 - ansible.builtin.action_common_attributes.flow
114 - microsoft.ad.action_reboot
115 attributes:
116 check_mode:
117 support: full
118 diff_mode:
119 support: none
120 platform:
121 platforms:
122 - windows
123 action:
124 support: full
125 async:
126 support: partial
127 details: Supported for all scenarios except with I(reboot=True).
128 bypass_host_loop:
129 support: none
130 seealso:
131 - module: microsoft.ad.computer
132 - module: microsoft.ad.domain
133 - module: microsoft.ad.domain_child
134 - module: microsoft.ad.group
135 - module: microsoft.ad.membership
136 - module: microsoft.ad.user
137 - ref: Migration guide <ansible_collections.microsoft.ad.docsite.guide_migration.migrated_modules.win_domain_controller>
138 description: This module replaces C(ansible.windows.win_domain_controller). See the migration guide for details.
139 - module: ansible.windows.win_domain_controller
140 author:
141 - Matt Davis (@nitzmahone)
142 - Jordan Borean (@jborean93)
143
144 EXAMPLES: |
145 - name: Ensure a server is a domain controller
146 microsoft.ad.domain_controller:
147 dns_domain_name: ansible.vagrant
148 domain_admin_user: [email protected]
149 domain_admin_password: password123!
150 safe_mode_password: password123!
151 state: domain_controller
152 reboot: true
153
154 - name: Ensure a server is not a domain controller
155 microsoft.ad.domain_controller:
156 domain_admin_user: [email protected]
157 domain_admin_password: password123!
158 local_admin_password: password123!
159 state: member_server
160 reboot: true
161
162 - name: Promote server as a read only domain controller
163 microsoft.ad.domain_controller:
164 dns_domain_name: ansible.vagrant
165 domain_admin_user: [email protected]
166 domain_admin_password: password123!
167 safe_mode_password: password123!
168 state: domain_controller
169 read_only: true
170 site_name: London
171 reboot: true
172
173 # This scenario is not recommended, use reboot: true when possible
174 - name: Promote server with custom paths with manual reboot task
175 microsoft.ad.domain_controller:
176 dns_domain_name: ansible.vagrant
177 domain_admin_user: [email protected]
178 domain_admin_password: password123!
179 safe_mode_password: password123!
180 state: domain_controller
181 sysvol_path: D:\SYSVOL
182 database_path: D:\NTDS
183 domain_log_path: D:\NTDS
184 register: dc_promotion
185
186 - name: Reboot after promotion
187 ansible.windows.win_reboot:
188 when: dc_promotion.reboot_required
189
190 RETURN:
191 reboot_required:
192 description: True if changes were made that require a reboot.
193 returned: always
194 type: bool
195 sample: true