Ansible - Add Host Windows

Run the Powershell below on Windows nodes to enable WinRM:

https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1

Run the Powershell above on Windows nodes remotely via psexec to enable WinRM:

psexec \\myserver -accepteula -nobanner -s -u DOMAIN\Administrator powershell -ExecutionPolicy Bypass -Command "iwr https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 -UseBasicParsing | iex"

Configuration at server end to allow AD authentication:

cat > /etc/ansible/hosts << EOF
[windows]
172.16.0.1
172.16.0.2
EOF
cat > /etc/ansible/group_vars/windows.yml << EOF
ansible_user: xxx
ansible_password: xxx
ansible_port: 5986
ansible_winrm_server_cert_validation: ignore
ansible_connection: winrm
ansible_winrm_transport: basic
EOF