-
"Turn Windows features on or off"
-
Check "Windows Subsystem for Linux" and press OK. "Restart!"
-
Open the "Microsoft Store" and search for "Ubuntu"
-
I installed Ubuntu 20.04 LTS. Smash the Get button.
-
Open Ubuntu and wait "Installing, this may take a few minutes..." indeed
-
Set a username and password for the default UNIX user.
Enter new UNIX username: New password:
-
Become the root user $ sudo su
-
Set the root password
New password: ...
- Drop back to the regular user and install updates
$ sudo apt update $ sudo apt upgrade
- Install ansible + dependencies
$ sudo apt install python3-pip $ sudo apt install git libffi-dev libssl-dev $ pip3 install pywinrm $ pip3 install --user ansible
- Ensure ansible is working (I had to restart the Ubuntu WSL for the path register...)
$ ansible --version
- Create some symbolic links for convenience
$ ln -s /mnt/c ~/C $ ln -s /mnt/d ~/D $ ln -s '/home/dev/C/Documents and Settings/Dev' ~/Dev
- Run the ansible playbook
$ cd ~/Dev/repos/windows-ansible-playbook $ ansible-playbook hello.yml --connection=local
NOTE - if you are using Ubuntu 20.04 and face an issue like "Failed to create temporary directory..." it's probably due to GNU C library 'glibc' which is not compatible with the WSL. So basically sleep commands don't work and ansible "needs" that. Here's a quick workaround fix...
- Open the PowerShell as Administrator
Enter the following command and answer yes to every question:
WinRM qc
Now enter the following command:
Set-ExecutionPolicy
Enter the policy to be used as "Bypass"
Answer *yes* to change the policy.