Ansible on Windows 10
Ansible has no windows native support and because we use Windows 10 on all clients we tried to figure out how to run A on our machines. One very straight forward way is to run it in WLS2 (Windows Linux Subsystem). There are many tutorials on how to install WSL2 support into Windows 10 so we can skip it here. Now let’s assume we have chosen Ubuntu as WSL implementation, so after WSL installed correctly, we have Ubuntu console available for management.
Now we are in an environment that is Ansible friendly. We can install it using common apt command:
sudo apt install ansible
When successful installation completed, Ansible is available as a Linux command. To call it from Windows itself (e.g. from bat files) we can call it as in this example:
bash -c "ansible server1 -a 'ps ax' -u root --ask-pass"
Bash runs this command in context of current Windows directory what is important for managing e.g. hosts files etc.