Ansible Pilot

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

How to install and maintain Ansible inside Windows 11 using the Windows Subsystem for Linux and Ubuntu 20.04 LTS.

January 10, 2022
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons

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.

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.

More technical information:

The Best Resources For Ansible


Video Course

Printed Book



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


wsl --help
wsl --list -o
wsl --install



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

Install the latest PowerShell for new features and improvements!

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>
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:
Enter new UNIX username: demo
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:
 * Management:
 * Support:

  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:
  Memory usage:   73%       IPv4 address for eth1:
  Swap usage:     1%        IPv4 address for eth1:
  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/demo/.hushlogin file.
demo@demo:~$ sudo su
[sudo] password for demo:
root@demo:/home/demo# apt-get update
Get:1 focal InRelease [265 kB]
Get:2 focal-updates InRelease [114 kB]
Get:3 focal-security InRelease [114 kB]
Get:4 focal-backports InRelease [108 kB]
Get:5 focal/main amd64 Packages [970 kB]
Get:6 focal/main Translation-en [506 kB]
Get:7 focal/main amd64 c-n-f Metadata [29.5 kB]
Get:8 focal/universe amd64 Packages [8628 kB]
Get:9 focal/universe Translation-en [5124 kB]
Get:10 focal-security/main amd64 Packages [1109 kB]
Get:11 focal-security/main Translation-en [202 kB]
Get:12 focal-security/main amd64 c-n-f Metadata [9104 B]
Get:13 focal/universe amd64 c-n-f Metadata [265 kB]
Get:14 focal/multiverse amd64 Packages [144 kB]
Get:15 focal-security/restricted amd64 Packages [609 kB]
Get:16 focal/multiverse Translation-en [104 kB]
Get:17 focal/multiverse amd64 c-n-f Metadata [9136 B]
Get:18 focal-updates/main amd64 Packages [1445 kB]
Get:19 focal-security/restricted Translation-en [86.8 kB]
Get:20 focal-security/restricted amd64 c-n-f Metadata [536 B]
Get:21 focal-security/universe amd64 Packages [675 kB]
Get:22 focal-security/universe Translation-en [114 kB]
Get:23 focal-security/universe amd64 c-n-f Metadata [13.0 kB]
Get:24 focal-security/multiverse amd64 Packages [21.8 kB]
Get:25 focal-security/multiverse Translation-en [4948 B]
Get:26 focal-security/multiverse amd64 c-n-f Metadata [536 B]
Get:27 focal-updates/main Translation-en [289 kB]
Get:28 focal-updates/main amd64 c-n-f Metadata [14.7 kB]
Get:29 focal-updates/restricted amd64 Packages [663 kB]
Get:30 focal-updates/restricted Translation-en [94.6 kB]
Get:31 focal-updates/restricted amd64 c-n-f Metadata [532 B]
Get:32 focal-updates/universe amd64 Packages [892 kB]
Get:33 focal-updates/universe Translation-en [195 kB]
Get:34 focal-updates/universe amd64 c-n-f Metadata [19.9 kB]
Get:35 focal-updates/multiverse amd64 Packages [24.8 kB]
Get:36 focal-updates/multiverse Translation-en [6928 B]
Get:37 focal-updates/multiverse amd64 c-n-f Metadata [620 B]
Get:38 focal-backports/main amd64 Packages [42.0 kB]
Get:39 focal-backports/main Translation-en [10.0 kB]
Get:40 focal-backports/main amd64 c-n-f Metadata [864 B]
Get:41 focal-backports/restricted amd64 c-n-f Metadata [116 B]
Get:42 focal-backports/universe amd64 Packages [19.5 kB]
Get:43 focal-backports/universe Translation-en [13.4 kB]
Get:44 focal-backports/universe amd64 c-n-f Metadata [656 B]
Get:45 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 focal/main amd64 python3-crypto amd64 2.6.1-13ubuntu2 [237 kB]
Get:2 focal/main amd64 python3-dnspython all 1.16.0-1build1 [89.1 kB]
Get:3 focal/main amd64 ieee-data all 20180805.1 [1589 kB]
Get:4 focal-updates/main amd64 python3-netaddr all 0.7.19-3ubuntu1 [236 kB]
Get:5 focal/universe amd64 ansible all 2.9.6+dfsg-1 [5794 kB]
Get:6 focal/universe amd64 python3-argcomplete all 1.8.1-1.3ubuntu1 [27.2 kB]
Get:7 focal-updates/main amd64 python3-jmespath all 0.9.4-2ubuntu1 [21.5 kB]
Get:8 focal/universe amd64 python3-kerberos amd64 1.1.14-3.1build1 [22.6 kB]
Get:9 focal/main amd64 python3-lockfile all 1:0.12.2-2ubuntu2 [14.6 kB]
Get:10 focal/universe amd64 python3-libcloud all 2.8.0-1 [1403 kB]
Get:11 focal/universe amd64 python3-ntlm-auth all 1.1.0-1 [19.6 kB]
Get:12 focal/universe amd64 python3-requests-kerberos all 0.12.0-2 [11.9 kB]
Get:13 focal/universe amd64 python3-requests-ntlm all 1.1.0-1 [6004 B]
Get:14 focal/universe amd64 python3-selinux amd64 3.0-1build2 [139 kB]
Get:15 focal/universe amd64 python3-xmltodict all 0.12.0-1 [12.6 kB]
Get:16 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]

code with ❤️ in GitHub


Now you know how to install the latest version of Ansible in Windows 11 using the Windows Subsystem for Linux. Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.


Learn the Ansible automation technology with some real-life examples in my

My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps

BUY the Complete PDF BOOK to easily Copy and Paste the 250+ Ansible code

Want to keep this project going? Please donate

Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons
Follow me

Subscribe not to miss any new releases