This role is not considered done
This role will join a Windows host to a Active Directory domain.
Based of the work done by @jborean93 in jborean93/ansible-windows
Works on
- Windows Server 2019
- Windows Server 2016
- Windows Server 2012R2
- Windows Server 2012
Not validated (yet) on
- Windows Server 2008R2
- Windows Server 2008 x64
- Windows Server 2008 x32
python3-winrm
(pywinrm
) is needed for WinRM.
defaults/main.yml
Variable | Description | Default value |
---|---|---|
joinad_domain | The Domain of the new Active Directory Forest. This should be changed your Domain | ad.example.test |
joinad_admin_username | The username of the account to add the computer to the domain. Change this depending on your needs. | administrator@{{ joinad_domain }} |
joinad_admin_password | The password of the account to add the computer to the domain. Change this depending on your needs. | P@ssw0rd! |
joinad_reboot_timeout | Maximum seconds to wait for machine to re-appear on the network and respond to a test command. | 600 |
joinad_post_reboot_delay | Seconds to wait after the reboot command was successful before attempting to validate the system rebooted successfully. | 300 |
- WinRM on the windows host should configured for Ansible.
- justin_p.posh5
- justin_p.wincom
- hosts: domain_members
roles:
- role: justin_p.posh5
- role: justin_p.wincom
- role: justin_p.joinad
This role includes a Vagrantfile that will spin up a local Windows Server 2019 VM in Virtualbox.
After creating the VM it will automatically run our role.
pip3 install pywinrm
- Run
vagrant up
to create a VM and run our role. - Run
vagrant provision
to reapply our role. - Run
vagrant destroy -f && vagrant up
to recreate the VM and run our role. - Run
vagrant destroy
to remove the VM.
MIT
- Justin Perdok (@justin-p), Orange Cyberdefense
Feel free to open issues, contribute and submit your Pull Requests. You can also ping me on Twitter (@JustinPerdok).