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.
Links
More technical information:
- https://docs.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
``PowerShell
wsl --help
wsl --list -o
wsl --install
`
execution
output
- install WSL
`PowerShell
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
``PowerShell
Installing,