How to install Ansible on Windows?
Love Ansible but don't know how to make it work on Windows?
Ansible is one of the most popular configuration administration and infrastructure automation tools. It helps automate infrastructure setup/provisioning, software deployment, and overall infrastructure management.
Ansible was originally available for Linux. However, with Microsoft's new take on open source, community improvements, and their adoption of a more agile DevOps-focused software development method, Windows support is slowly catching up.
While Windows support requires a bit more setup, it's not too bad once the initial setup is complete. There are two possible ways to install it.
Using Cygwin
Have you heard of Cygwin?
It is a POSIX compliant environment for running on Windows. This means that you can run many things on Windows that you would normally do on a UNIX based OS.
If this is your first time hearing about Cygwin, I would refer to their official site for more understanding.
The Cygwin installation does not cover Ansible by default. Therefore, you must select them during installation, as described below, manually.
- Download Cygwin (Choose 32-bit or 64-bit Cygwin package according to your system)
- Run the Cygwin setup file you downloaded above and follow the instructions on the screen.
- Select the download source as "Install from Internet".

- Set the root directory where you want to install the application.

- Select the directory where you want to install the Cygwin packages.
- Select Direct Connection if you are not using a proxy.

- Choose a mirror to download your packages. You can choose any from the list.

- Packages available for installation will be shown; here we have to select ansible - explicitly select the view as Full and then search for "ansible" and then select the latest version as shown below.
- ansible-doc is optional, click next

- Review and confirm the changes by clicking Next.

- It will download and install the required packages.

- You will then receive a success message, click Finish.

Congratulations! You have installed Cygwin with Ansible on Windows. Let's check it out.
- Double-click the Cygwin terminal icon on the desktop and type ansible –version.

And, as you can see, it was successfully installed.
Come on, play with him. If you are interested in learning Ansible, check out this Udemy course .
Using Ubuntu on Windows 10
Thanks to Microsoft. Now you can install Ubuntu on Windows 10.
Let's start.
- Search for Windows components in the search box. And when "Turn Windows features on or off" appears, click on it.

- A window with a bunch of functions will open. Scroll down and check the "Windows Subsystem for Linux" box. And after that click on the OK button.

- Open the Microsoft Store and search for Ubuntu to install the latest version.

- Once installed, you will see a start button, use it to open Ubuntu bash.
- In Ubuntu bash, you will be prompted to set a username and password for the default user. You can also set the password for the root account by typing sudo passwd root

- It's time to install Ansible with the following commands.
sudo apt-get updatesudo apt-get install software-properties-common sudo apt-add-repository ppa:ansible/ansible sudo apt-get update sudo apt-get install ansible
- Press Y when it asks...

Once installed, let's test it out by creating and running a demo playbook.
- Create a file called testbook.yml
nano testbook.yml
- Add the following lines and save the file
- name: testing ansiblehosts: localhost tasks: - name: echo a message debug: msg=”this is working"

And finally start the playbook.
ansible playbook testbook.yml --connection=local
Conclusion
I hope this helps you install Ansible on Windows. Read this blog post to learn about playbook for automating tasks.
Did you enjoy reading the article? How about sharing with the world?
What do you think of this article?