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_membership - Manage domain/workgroup membership for a Windows host¶
Manages domain membership or workgroup membership for a Windows host. Also supports hostname changes. This module may require subsequent use of the win_reboot action if changes are made.
# host should be a member of domain ansible.vagrant; module will ensure the hostname is mydomainclient# and will use the passed credentials to join domain if necessary.# Ansible connection should use local credentials if possible.# If a reboot is required, the second task will trigger one and wait until the host is available.-hosts:winclientgather_facts:notasks:-win_domain_membership:dns_domain_name:ansible.vagranthostname:mydomainclientdomain_admin_user:testguy@ansible.vagrantdomain_admin_password:password123!domain_ou_path:"OU=Windows,OU=Servers,DC=ansible,DC=vagrant"state:domainregister:domain_state-win_reboot:when:domain_state.reboot_required# Host should be in workgroup mywg- module will use the passed credentials to clean-unjoin domain if possible.# Ansible connection should use local credentials if possible.# The domain admin credentials can be sourced from a vault-encrypted variable-hosts:winclientgather_facts:notasks:-win_domain_membership:workgroup_name:mywgdomain_admin_user:'{{win_domain_admin_user}}'domain_admin_password:'{{win_domain_admin_password}}'state:workgroup
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>