You are reading an unmaintained version of the Ansible documentation. Unmaintained Ansible versions can contain unfixed security vulnerabilities (CVE). Please upgrade to a maintained version. See the latest Ansible documentation.
win_domain_controller - Manage domain controller/member server state for a Windows host¶
Ensure that a Windows Server 2012+ host is configured as a domain controller or demoted to member server. This module may require subsequent use of the win_reboot action if changes are made.
# ensure a server is a domain controller-hosts:winclientgather_facts:notasks:-win_domain_controller:dns_domain_name:ansible.vagrantdomain_admin_user:testguy@ansible.vagrantdomain_admin_password:password123!safe_mode_password:password123!state:domain_controllerlog_path:c:\ansible_win_domain_controller.txt# ensure a server is not a domain controller# note that without an action wrapper, in the case where a DC is demoted,# the task will fail with a 401 Unauthorized, because the domain credential# becomes invalid to fetch the final output over WinRM. This requires win_async# with credential switching (or other clever credential-switching# mechanism to get the output and trigger the required reboot)-hosts:winclientgather_facts:notasks:-win_domain_controller:domain_admin_user:testguy@ansible.vagrantdomain_admin_password:password123!local_admin_password:password123!state:member_serverlog_path:c:\ansible_win_domain_controller.txt
For more information about Red Hat’s this support of this module, please
refer to this knowledge base article<https://access.redhat.com/articles/rhel-top-support-policies>