As a services leader for our public sector customers here at Red Hat, I find myself in an odd situation. Many of my customers require connecting through remote access tools only available on Windows. For my own simplicity, I run with Windows 11 as my daily driver, using it for everything I do, and with the power of Windows Subsystem for Linux, I’m able to do everything my counterparts with Linux or Mac desktops can.
Why develop on Windows?
Quite often in business environments, Windows is the standard-issue desktop for everyone. Or it may be a personal preference, for running other apps or in a shared environment with other users. But even so, this shouldn’t be an inhibitor to a proper and featured developer experience. With the right permissions, we can still be powerful Ansible developers using Windows and WSL.
What to expect in this post
In this post, we’re going to go through the steps for an individual Ansible content contributor to set up a feature-rich development environment on a Windows desktop. Providing a quality development environment is a core tenet of an automation-first approach, as the process to create automation must be as easy as hand-fix approaches if automation is truly going to assist the operator in their work. That, at least to me, means native and supported tooling within a persistent environment that I can customize to assist with my personal and corporate processes.
Setting up your Windows workstation
Getting started, we need to have WSL (Windows Subsystem for Linux) available on our workstation, which we can follow this guide from Microsoft to do so.
Within WSL, we have options of what linux distribution to use. While Red Hat Enterprise Linux is coming as an official distribution soon, it isn’t currently available at the time of writing. We can, however, use image builder and create our own WSL image based on RHEL, following this previous post on developers.redhat.com, or use another repackage of Enterprise Linux. For this exercise, I am using a RHEL 9 WSL image.
Using a WSL in VSCode on Windows
Using a WSL container with VSCode is fairly straightforward,. You will need to install 2 extensions on VScode:
- WSL from Microsoft
- DevContainers from Microsoft
From here, we can now connect to our WSL instance to have a linux-backed vscode environment. I’ve illustrated these steps below:
The bottom left corner has a remote connection icon, we can use this to connect to our WSL instance. If you have multiple WSL distros installed, you can specify which one.
Now, from here, you can see what WSL instance you are connected to in that bottom corner, as you’re running a unique instance of VSCode with WSL-hosted extensions. As you now go and install your desired extensions, such as Ansible and YAML, you’ll see two categories on your extension list, local (installed on the windows side of your developer environment) and WSL installed extensions.
From here, you’re ready to roll! You’ve got a persistent RHEL environment backing the developer environment, so anything that you may have forgotten to put into your base image can be installed with dnf or pip, and the tools you need as an Ansible developer are at your fingertips, including linting, autocompletion, ansible-vault and Ansible Lightspeed.
Now you’re set to develop automation with all the tools available to a linux-based developer, now on a Windows machine.
What to expect next
In future weeks, we’ll dive further into how to deliver these capabilities at scale so that each developer doesn’t have to perform their own workspace configuration. Meanwhile, we would love to hear your thoughts on this approach. We would also love to learn other approaches you’ve taken in helping onboard ansible content creators in your organization.