Tuesday, September 7, 2021

Setting up Ansible in Windows using WSL

Ansible is an open-source IT automation engine which is used to achieve several IT infrastructure automation needs such as configuration management, provisioning, deployment and many more. This blog explains how to get started with Ansible in Windows.

Pre-requisites:

  • Windows 10 Machine

Let's get started.

First, we need to install Windows Subsystem for Linux (WSL) and Ubuntu in Windows machine as preparation prior to installing Ansible.

Login to Windows machine and open PowerShell in Administrative mode. Run following command to install WSL.

Enable-WindowsOptionalFeature -online -FeatureName Microsoft-Windows-Subsystem-Linux

AS the next step, Install Ubuntu using Microsoft Store. Ubuntu 18.04 LTS is installed in this blog.


Launch Ubuntu once the installation completed. Enter user name and passwords to create default UNIX user account.


Now,  run following commands to install dependencies and Ansible

  • Get list of latest versions of existing packages and new packages

            sudo apt-get update

  • Install pip tool

            sudo apt-get install python3-pip -y

  • Install ansible

            sudo pip3 install ansible

  • Use following command to verify ansible is installed correctly

            ansible --version

  • Install python modules to communicate with Windows

            sudo pip3 install pywinrm

            sudo pip3 install pywinrm[credssp]


You can start using Ansible in a Windows Machine using Windows Subsystem for Linux as explained above.

No comments:

Post a Comment