Running Ansible From Windows Using Virtualization

Recently, I had to use Ansible to implement infrastructure as code. Initially, I used Windows Subsystem for Linux (WSL) to run the Ansible playbooks. The advantage of WSL is that it gives one a Linux shell on a Windows machine without any further ado. However, I found that WSL has this tendency to go haywire and use system resources such as CPU and RAM to the max. Although it did not lead to performance degradation in other running processes or applications, it did cause my notebook with 40GB of RAM to become very hot and use excessive electricity. Once WSL reaches this state, all new requests for a WSL prompt hang. Since the virtual memory processes used to enable WSL are protected and cannot be killed or restarted, the only recourse is a good old Windows reboot.  

I considered installing Linux on an old notebook and running the Ansible playbooks from there. Unfortunately, the target servers are behind a VPN, so the Linux machine would have to receive special software to allow it to join the VPN. In order to sidestep corporate hassle, I went with running Linux virtually on Hyper-V, the native Windows 10 Hypervisor. The steps I followed will be documented next.

CategoriesUncategorized