Skip to content

Instantly share code, notes, and snippets.

@gregjhogan
Last active October 28, 2021 11:43
Show Gist options
  • Save gregjhogan/beda2e3b23c5cab93735f4e62f84de00 to your computer and use it in GitHub Desktop.
Save gregjhogan/beda2e3b23c5cab93735f4e62f84de00 to your computer and use it in GitHub Desktop.
ansible windows 10 WSL configuration
sudo apt-get -y update
sudo apt-get -y install python
sudo easy_install pip
sudo pip install ansible
sudo pip install "pywinrm>=0.2.2"
# kerberos authentication support
#sudo apt-get install -y python-dev libkrb5-dev krb5-user
#sudo pip install pywinrm[kerberos]
# fix for https://github.com/Microsoft/BashOnWindows/issues/286
sudo apt-get install -y execstack
sudo execstack -c /usr/local/lib/python2.7/dist-packages/cryptography/hazmat/bindings/_openssl.so
# test connectivity and authentication
ansible windows -i ./hosts -m win_ping -u user@domain.com -k
# windows patches (will not reboot)
ansible windows -i ./hosts -m win_updates -u user@domain.com -k
# windows reboot
ansible windows -i ./hosts -m win_reboot -u user@domain.com -k
# place file here: ./hosts
[windows]
VM.DOMAIN.COM
# place file here: ./group_vars/windows.yml
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_scheme: https
ansible_winrm_transport: ntlm
ansible_winrm_server_cert_validation: ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment