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

Install Ansible on Windows WSL2 (Step-by-Step 2026)

Step-by-step guide to install Ansible on Windows WSL2. Copy-paste commands, verify installation, and configure for production.

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 โ€” WSL2 is the recommended approach.

Step 1: Enable WSL2

# Run in PowerShell as Administrator
wsl --install
# Restart your computer

Step 2: Install Ubuntu in WSL2

wsl --install -d Ubuntu-24.04

Step 3: Install Ansible Inside WSL2

# Update packages
sudo apt update && sudo apt upgrade -y

# Install Ansible
sudo apt install -y ansible

# Or via pip for latest version
sudo apt install -y python3-pip python3-venv
python3 -m venv ~/ansible-venv
source ~/ansible-venv/bin/activate
pip install ansible

Verify

ansible --version
ansible localhost -m ping

Access Windows Files from WSL2

# Windows C: drive is mounted at /mnt/c
ls /mnt/c/Users/YourUsername/

Free 30-min AI & Cloud consultation

Book Now