AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

How to install Ansible in Windows 11 WSL Windows Subsystem for Linux - Ansible install

By Luca Berton · Published 2024-01-01 · Category: installation

Install Ansible on Windows 11 using WSL in 2026. Updated guide with WSL2, Ubuntu, and pip installation steps.

How to install Ansible in Windows 11 WSL Windows Subsystem for Linux - Ansible install

How to install Ansible in Windows 11. Today we're going to talk about the easier way to install and maintain Ansible inside Windows 11 using the Windows Subsystem for Linux. I'm Luca Berton and welcome to today's episode of Ansible Pilot.

How to install Ansible in Windows 11

Today we're talking about How to install Ansible in Windows 11. Officially Windows is not a supported operating system for the control node even if RedHat is working really hard to eliminate barriers to native Windows controllers. The reason behind this is that there are a lot of UNIX-isms deeply baked into most of Ansible that prevents it from working on native Windows, basically, Windows doesn't have the fork() syscall implementation. Ansible controller worker model as of 2.11 makes heavy use of the POSIX fork() syscall. • Cygwin Some people used Cygwin POSIX-compatibility projects but sometimes it just breaks so it's not a reliable solution. • Windows Subsystem for Linux

The best alternative is to use Windows Subsystem for Linux, also known as WSL. Run WSL version 2 if Windows 10 later than build 2004 or Windows 11. Ansible works great on WSL and WSL2.

See also: Four Methods to Configure Maximum PowerShell Memory in Windows Server

More technical information: • https://learn.microsoft.com/en-us/windows/wsl/compare-versions • https://docs.ansible.com/ansible/latest/user_guide/windows_faq.html • https://arstechnica.com/gadgets/2021/10/the-best-part-of-windows-11-is-a-revamped-windows-subsystem-for-linux/

## Playbook

Let's jump in a quick live Playbook of how to install the latest and a specific version of Ansible in Windows using Windows Subsystem for Linux.

code

• install_wsl.ps1
wsl --help
wsl --list -o
wsl --install

execution

output • install WSL

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Users\user> wsl --install Installing: Virtual Machine Platform Virtual Machine Platform has been installed. Installing: Windows Subsystem for Linux Windows Subsystem for Linux has been installed. Downloading: WSL Kernel Installing: WSL Kernel WSL Kernel has been installed. Downloading: GUI App Support Installing: GUI App Support GUI App Support has been installed. Downloading: Ubuntu The requested operation is successful. Changes will not be effective until the system is rebooted. PS C:\Users\user>

• setup Ubuntu 20.04 LTS WSL and install ansible

Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: Playbook
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 20.04 LTS (GNU/Linux 4.4.0-22000-Microsoft x86_64)

* Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage

System information as of Mon Jan 10 16:57:36 UTC 2022

System load: 0.52 Users logged in: 0 Usage of /home: unknown IPv4 address for eth0: 10.0.2.15 Memory usage: 73% IPv4 address for eth1: 169.254.235.130 Swap usage: 1% IPv4 address for eth1: 192.168.0.209 Processes: 7

0 updates can be installed immediately. 0 of these updates are security updates.

The list of available updates is more than a week old. To check for new updates run: sudo apt update

This message is shown once once a day. To disable it please create the /home/Playbook/.hushlogin file. Playbook@demo:~$ sudo su [sudo] password for Playbook: root@demo:/home/demo# apt-get update Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB] Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB] Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB] Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [970 kB] Get:6 http://archive.ubuntu.com/ubuntu focal/main Translation-en [506 kB] Get:7 http://archive.ubuntu.com/ubuntu focal/main amd64 c-n-f Metadata [29.5 kB] Get:8 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [8628 kB] Get:9 http://archive.ubuntu.com/ubuntu focal/universe Translation-en [5124 kB] Get:10 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1109 kB] Get:11 http://security.ubuntu.com/ubuntu focal-security/main Translation-en [202 kB] Get:12 http://security.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [9104 B] Get:13 http://archive.ubuntu.com/ubuntu focal/universe amd64 c-n-f Metadata [265 kB] Get:14 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [144 kB] Get:15 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [609 kB] Get:16 http://archive.ubuntu.com/ubuntu focal/multiverse Translation-en [104 kB] Get:17 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 c-n-f Metadata [9136 B] Get:18 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1445 kB] Get:19 http://security.ubuntu.com/ubuntu focal-security/restricted Translation-en [86.8 kB] Get:20 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 c-n-f Metadata [536 B] Get:21 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [675 kB] Get:22 http://security.ubuntu.com/ubuntu focal-security/universe Translation-en [114 kB] Get:23 http://security.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [13.0 kB] Get:24 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [21.8 kB] Get:25 http://security.ubuntu.com/ubuntu focal-security/multiverse Translation-en [4948 B] Get:26 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 c-n-f Metadata [536 B] Get:27 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [289 kB] Get:28 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [14.7 kB] Get:29 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [663 kB] Get:30 http://archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [94.6 kB] Get:31 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 c-n-f Metadata [532 B] Get:32 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [892 kB] Get:33 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [195 kB] Get:34 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [19.9 kB] Get:35 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [24.8 kB] Get:36 http://archive.ubuntu.com/ubuntu focal-updates/multiverse Translation-en [6928 B] Get:37 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [620 B] Get:38 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [42.0 kB] Get:39 http://archive.ubuntu.com/ubuntu focal-backports/main Translation-en [10.0 kB] Get:40 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 c-n-f Metadata [864 B] Get:41 http://archive.ubuntu.com/ubuntu focal-backports/restricted amd64 c-n-f Metadata [116 B] Get:42 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [19.5 kB] Get:43 http://archive.ubuntu.com/ubuntu focal-backports/universe Translation-en [13.4 kB] Get:44 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [656 B] Get:45 http://archive.ubuntu.com/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B] Fetched 23.0 MB in 7s (3188 kB/s) Reading package lists... Done root@demo:/home/demo# apt-get install ansible Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: ieee-data python3-argcomplete python3-crypto python3-dnspython python3-jmespath python3-kerberos python3-libcloud python3-lockfile python3-netaddr python3-ntlm-auth python3-requests-kerberos python3-requests-ntlm python3-selinux python3-winrm python3-xmltodict Suggested packages: cowsay sshpass python-lockfile-doc ipython3 python-netaddr-docs The following NEW packages will be installed: ansible ieee-data python3-argcomplete python3-crypto python3-dnspython python3-jmespath python3-kerberos python3-libcloud python3-lockfile python3-netaddr python3-ntlm-auth python3-requests-kerberos python3-requests-ntlm python3-selinux python3-winrm python3-xmltodict 0 upgraded, 16 newly installed, 0 to remove and 251 not upgraded. Need to get 9644 kB of archives. After this operation, 90.2 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 python3-crypto amd64 2.6.1-13ubuntu2 [237 kB] Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 python3-dnspython all 1.16.0-1build1 [89.1 kB] Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 ieee-data all 20180805.1 [1589 kB] Get:4 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-netaddr all 0.7.19-3ubuntu1 [236 kB] Get:5 http://archive.ubuntu.com/ubuntu focal/universe amd64 ansible all 2.9.6+dfsg-1 [5794 kB] Get:6 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-argcomplete all 1.8.1-1.3ubuntu1 [27.2 kB] Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-jmespath all 0.9.4-2ubuntu1 [21.5 kB] Get:8 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-kerberos amd64 1.1.14-3.1build1 [22.6 kB] Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 python3-lockfile all 1:0.12.2-2ubuntu2 [14.6 kB] Get:10 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-libcloud all 2.8.0-1 [1403 kB] Get:11 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-ntlm-auth all 1.1.0-1 [19.6 kB] Get:12 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-requests-kerberos all 0.12.0-2 [11.9 kB] Get:13 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-requests-ntlm all 1.1.0-1 [6004 B] Get:14 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-selinux amd64 3.0-1build2 [139 kB] Get:15 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-xmltodict all 0.12.0-1 [12.6 kB] Get:16 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-winrm all 0.3.0-2 [21.7 kB] Fetched 9644 kB in 2s (4411 kB/s) Selecting previously unselected package python3-crypto. (Reading database ... 31836 files and directories currently installed.) Preparing to unpack .../00-python3-crypto_2.6.1-13ubuntu2_amd64.deb ... Unpacking python3-crypto (2.6.1-13ubuntu2) ... Selecting previously unselected package python3-dnspython. Preparing to unpack .../01-python3-dnspython_1.16.0-1build1_all.deb ... Unpacking python3-dnspython (1.16.0-1build1) ... Selecting previously unselected package ieee-data. Preparing to unpack .../02-ieee-data_20180805.1_all.deb ... Unpacking ieee-data (20180805.1) ... Selecting previously unselected package python3-netaddr. Preparing to unpack .../03-python3-netaddr_0.7.19-3ubuntu1_all.deb ... Unpacking python3-netaddr (0.7.19-3ubuntu1) ... Selecting previously unselected package ansible. Preparing to unpack .../04-ansible_2.9.6+dfsg-1_all.deb ... Unpacking ansible (2.9.6+dfsg-1) ... Selecting previously unselected package python3-argcomplete. Preparing to unpack .../05-python3-argcomplete_1.8.1-1.3ubuntu1_all.deb ... Unpacking python3-argcomplete (1.8.1-1.3ubuntu1) ... Selecting previously unselected package python3-jmespath. Preparing to unpack .../06-python3-jmespath_0.9.4-2ubuntu1_all.deb ... Unpacking python3-jmespath (0.9.4-2ubuntu1) ... Selecting previously unselected package python3-kerberos. Preparing to unpack .../07-python3-kerberos_1.1.14-3.1build1_amd64.deb ... Unpacking python3-kerberos (1.1.14-3.1build1) ... Selecting previously unselected package python3-lockfile. Preparing to unpack .../08-python3-lockfile_1%3a0.12.2-2ubuntu2_all.deb ... Unpacking python3-lockfile (1:0.12.2-2ubuntu2) ... Selecting previously unselected package python3-libcloud. Preparing to unpack .../09-python3-libcloud_2.8.0-1_all.deb ... Unpacking python3-libcloud (2.8.0-1) ... Selecting previously unselected package python3-ntlm-auth. Preparing to unpack .../10-python3-ntlm-auth_1.1.0-1_all.deb ... Unpacking python3-ntlm-auth (1.1.0-1) ... Selecting previously unselected package python3-requests-kerberos. Preparing to unpack .../11-python3-requests-kerberos_0.12.0-2_all.deb ... Unpacking python3-requests-kerberos (0.12.0-2) ... Selecting previously unselected package python3-requests-ntlm. Preparing to unpack .../12-python3-requests-ntlm_1.1.0-1_all.deb ... Unpacking python3-requests-ntlm (1.1.0-1) ... Selecting previously unselected package python3-selinux. Preparing to unpack .../13-python3-selinux_3.0-1build2_amd64.deb ... Unpacking python3-selinux (3.0-1build2) ... Selecting previously unselected package python3-xmltodict. Preparing to unpack .../14-python3-xmltodict_0.12.0-1_all.deb ... Unpacking python3-xmltodict (0.12.0-1) ... Selecting previously unselected package python3-winrm. Preparing to unpack .../15-python3-winrm_0.3.0-2_all.deb ... Unpacking python3-winrm (0.3.0-2) ... Setting up python3-lockfile (1:0.12.2-2ubuntu2) ... Setting up python3-ntlm-auth (1.1.0-1) ... Setting up python3-kerberos (1.1.14-3.1build1) ... Setting up python3-xmltodict (0.12.0-1) ... Setting up python3-jmespath (0.9.4-2ubuntu1) ... Setting up python3-requests-kerberos (0.12.0-2) ... Setting up ieee-data (20180805.1) ... Setting up python3-dnspython (1.16.0-1build1) ... Setting up python3-selinux (3.0-1build2) ... Setting up python3-crypto (2.6.1-13ubuntu2) ... Setting up python3-argcomplete (1.8.1-1.3ubuntu1) ... Setting up python3-requests-ntlm (1.1.0-1) ... Setting up python3-libcloud (2.8.0-1) ... Setting up python3-netaddr (0.7.19-3ubuntu1) ... Setting up python3-winrm (0.3.0-2) ... Setting up ansible (2.9.6+dfsg-1) ... Processing triggers for man-db (2.9.1-1) ... root@demo:/home/demo# ansible --version ansible 2.9.6 config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3/dist-packages/ansible executable location = /usr/bin/ansible python version = 3.8.2 (default, Mar 13 2020, 10:14:16) [GCC 9.3.0] root@demo:/home/demo# apt list ansible Listing... Done ansible/focal,now 2.9.6+dfsg-1 all [installed] root@demo:/home/demo#

code with ❤️ in GitHub

Conclusion

Now you know how to install the latest version of Ansible in Windows 11 using the Windows Subsystem for Linux.

See also: Install Ansible on Windows 10 WSL: Step-by-Step Guide (2026)

Related Articles

Windows management with Ansible

Category: installation

Watch the video: How to install Ansible in Windows 11 WSL Windows Subsystem for Linux - Ansible install — Video Tutorial

Browse all Ansible tutorials · AnsiblePilot Home