Skip to main content
๐ŸŽ“ Claude Code Masterclass Learn AI-assisted development on Udemy โ€” plus the companion book on Leanpub & Amazon. Start Learning
How to Install Ansible on Windows WSL2
Automation

How to Install Ansible on Windows WSL2

Step-by-step guide to install Ansible on Windows WSL2. Covers package installation, pip install, version management, and first playbook setup.

LB
Luca Berton
ยท 1 min read

Here is how to install Ansible on Windows using WSL2 in 2026. Ansible does not run natively on Windows.

Step 1: Install WSL2

wsl --install -d Ubuntu-24.04

Restart and complete the Ubuntu setup.

Step 2: Install Ansible

sudo apt update && sudo apt upgrade -y
sudo apt install -y ansible

Verify

ansible --version
ansible localhost -m ping

Alternative: pip

sudo apt install -y python3-pip python3-venv
python3 -m venv ~/ansible-venv
source ~/ansible-venv/bin/activate
pip install ansible

Managing Windows Hosts from WSL2

pip install pywinrm
ansible-galaxy collection install community.windows

Free 30-min AI & Cloud consultation

Book Now