How to Install Ansible on Windows 11

Ansible is one of the most popular open-source automation tools used for configuration management, application deployment, and orchestration. However, there’s a small catch — Ansible was originally designed to run on Linux or macOS, not directly on Windows.

But don’t worry — with Windows Subsystem for Linux (WSL), you can now install and use Ansible on Windows 11 with ease. In this guide, we’ll walk you through how to install, configure, and use Ansible on Windows 11, step by step.

What Is Ansible?

Ansible is a powerful automation tool developed by Red Hat. It allows you to automate repetitive IT tasks such as server provisioning, software deployment, and configuration management using simple, human-readable YAML files called playbooks.

Unlike other automation tools, Ansible doesn’t require agents on remote systems — it connects over SSH, making it lightweight and easy to use.

  • Agentless (no software installation on target nodes)
  • Simple YAML syntax for automation scripts
  • Scalable for managing thousands of systems
  • Integrates with tools like Docker, Kubernetes, and AWS

Prerequisites

Before installing Ansible, make sure the following requirements are met:

  • Windows 11 (Build 22000 or newer)
  • Windows Subsystem for Linux (WSL2) installed
  • Ubuntu or another Linux distribution installed via Microsoft Store
  • Administrator access

Step 1: Enable Windows Subsystem for Linux (WSL)

Since Ansible doesn’t run natively on Windows, we’ll first enable WSL2, which allows you to run Linux directly inside Windows 11.

  1. Press Windows + X → Select Windows Terminal (Admin).
  2. Run the following command to enable WSL and Virtual Machine Platform: wsl --install
  3. Once the process completes, restart your PC.
  4. After reboot, WSL will automatically install the latest Ubuntu distribution by default.

Tip: If you prefer a different Linux distro (like Debian or Kali), you can install it later from the Microsoft Store.

Step 2: Update and Upgrade Your Linux Packages

Now that WSL is installed, open your Linux terminal (Ubuntu by default) and update the system packages.

  1. Open Ubuntu from the Start Menu.
  2. Run the following commands: sudo apt update && sudo apt upgrade -y
  3. Wait for the process to finish — this ensures all your packages are up to date.

Step 3: Install Ansible on Ubuntu (WSL)

Now comes the main part — installing Ansible.

  1. In your Ubuntu terminal, run: sudo apt install ansible -y
  2. Once installation completes, verify the version: ansible --version You should see output similar to: ansible [core 2.17.x] python version = 3.x

Tip: If you want the latest version of Ansible, install it using the official PPA repository:

sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y

Step 4: Configure Ansible (Optional)

You can customize your Ansible settings and inventory file for managing remote machines.

  1. Open the Ansible configuration directory: cd /etc/ansible
  2. Edit the inventory file using a text editor: sudo nano hosts
  3. Add your remote system’s IP or hostname under the [servers] section: [servers] 192.168.1.10 192.168.1.11
  4. Save the file and exit (Ctrl + O, then Enter, then Ctrl + X).

Now, Ansible will know which hosts to connect to for automation tasks.

Step 5: Test Ansible Connection

To make sure everything’s working, you can test Ansible by running a simple ping command.

  1. Run the following: ansible all -m ping
  2. If configured correctly, you’ll see: 192.168.1.10 | SUCCESS => { "changed": false, "ping": "pong" }

If you get a success message, congrats — Ansible is now installed and functional on Windows 11 through WSL!

Step 6: (Optional) Install Visual Studio Code for Ansible Development

If you want to write Ansible playbooks and YAML scripts efficiently, VS Code is the perfect editor.

  1. Download and install Visual Studio Code.
  2. Install the Ansible extension from the Extensions Marketplace.
  3. Open your WSL workspace from VS Code by running: code .
  4. You can now edit, run, and test Ansible playbooks directly from Windows.

Step 7: Keep Ansible Updated

Ansible updates frequently to improve automation capabilities and fix bugs.

Update command:

sudo apt update && sudo apt upgrade ansible -y

To verify the version after updating:

ansible --version

Wrapping Up

Installing Ansible on Windows 11 might sound tricky at first, but with WSL2 and Ubuntu, it becomes a seamless process. Once installed, you can manage Linux and Windows servers, automate configurations, and deploy apps — all from your Windows PC.

With this setup, you get the best of both worlds — the power of Linux automation and the convenience of Windows 11.

Posted by Arpita

With a background in Computer Science, she is passionate about sharing practical programming tips and tech know-how. From writing clean code to solving everyday tech problems, she breaks down complex topics into approachable guides that help others learn and grow.