Automated
This is experimental and not tested thoroughly. Use it at your own risk, and please report how it went.
This automates the Windows manual setup and installs Windows software I commonly use. Ansible runs from WSL and configures Windows over WinRM. It finds Windows by itself with either WSL networking mode: at 127.0.0.1 with mirrored networking, and at the default gateway with NAT (the default).
prepare-windows.ps1
Download this repository somewhere on Windows. The script prepare-windows.ps1:
- installs WSL with Ubuntu 26.04,
- enables WinRM with CredSSP authentication, so Ansible in WSL can configure Windows,
- installs the Chocolatey package manager.
Run it as Administrator from cmd or PowerShell.
prepare-ubuntu.sh
Then open Ubuntu and download the repository there as well.
Check that the distribution runs systemd, see Requirements.
In the repository root, run sudo ./prepare-ubuntu.sh. It updates the system and installs Python and Ansible.
setup-windows.yml
This playbook sets up Windows.
- Note your Windows user name. You pass it as
win_usernamewhen you run the playbook (see below). - Read
ansible/roles/windows/tasks/main.ymland the other task files in that directory to see what they change:common.ymlinstalls common software, like 7-Zip, Firefox and Bitwarden.dev.ymlinstalls Git, Windows Terminal, IntelliJ, VS Code, Docker Desktop and Postman.context_menu.ymlremoves the context menu entries some of these packages add.terminal.ymlinstalls the FiraCode font and applies settings to Windows Terminal.entertainment.ymlinstalls Spotify, VLC, Discord and similar.
To skip whole sections, set them to false in bundle_include. Because of the problem described below, pass it with -e as JSON, for example -e '{"bundle_include": {"common": true, "dev": true, "terminal": true, "entertainment": false, "context_menu": true}}'. The defaults are:
bundle_include:
common: true
dev: true
terminal: true
entertainment: true
context_menu: true
To skip single packages instead of a whole section, remove them from the task file in your own branch (for example ansible/roles/windows/tasks/entertainment.yml).
Then run, from the ansible/ directory:
ansible-playbook -i inventory.yml setup-windows.yml -k -e win_username=<your-windows-user>
-k asks for your Windows password.
win_username in overrides.yml has no effectsetup-windows.yml loads ansible/vars/overrides.yml with a lower precedence than the role's own variables, so a win_username set there is ignored and the default (Jimmy) is used. Pass it with -e as above until this is fixed. The same applies to every other windows role variable, including bundle_include.
If the run hangs for more than a few minutes, stop it with Ctrl+c and run it again. Chocolatey installations started from Ansible in WSL sometimes get stuck.