-
Install OpenSUSE Tumbleweed from Windows Store, and follow YaST2 setup afterward.
winget install --id 9MSSK2ZXXN11
-
Shutdown all WSL distros, and set OpenSUSE Tumbleweed as the default,
wsl --shutdown ; wsl --set-default openSUSE-Tumbleweed
-
Recommendedly, add the following lines in Windows
$HOME\.wslconfig
file,[wsl2] networkingMode = mirrored
-
Open Tumbleweed shell again, and upgrade all packages,
sudo zypper ref && sudo zypper dup
-
Shutdown all WSL distros again after upgrade finishes, and open Tumbleweed shell again,
wsl --shutdown
-
Optionally, set passwordless sudo. This will simplify your life in WSL.
sudo zypper in -y system-group-wheel &&\ sudo sh -c "echo '%wheel ALL=(ALL:ALL) NOPASSWD: ALL' > /usr/etc/sudoers.d/wheel" &&\ sudo usermod -aG wheel $USER
-
Install the latest Python with pyenv, this will take some time,
sudo zypper in -y -t pattern devel_C_C++ ;\ sudo zypper in -y \ pyenv \ xz-devel \ tk-devel \ libbz2-devel \ libffi-devel \ sqlite3-devel \ readline-devel \ libopenssl-devel ;\ pyenv install --list |\ awk '/^[0-9\. ]+$/ {ver=$1} END {print ver}' |\ xargs -I_ sh -c 'pyenv install _ && pyenv global _' ;\ sed -i '/# pyenv BEGIN/,/# pyenv END/d' ~/.$(basename $SHELL)rc ;\ cat <<'EOF' >> ~/.$(basename $SHELL)rc ; exec $SHELL # BEGIN pyenv export PYENV_ROOT="${HOME}/.pyenv" test -d "${PYENV_ROOT}/bin" && PATH=$_:$PATH && export PATH eval "$(pyenv init -)" # END pyenv EOF
-
Install Ansible with pipx,
pip install --upgrade pip &&\ pip install pipx &&\ pipx install --include-deps ansible &&\ pipx inject --include-apps ansible ansible-lint
-
Test Ansible on localhost,
ansible -i localhost, all -c local -m setup
-
Run the Ansible playbook,
ansible-playbook -i localhost, -c local setup.yaml -vv
-
Shutdown all WSL distros from PowerShell, and your Tumbleweed will be ready afterward.
wsl --shutdown
Run the following command to add ansible
function to PowerShell profile,
New-Item -ItemType Directory -Path ($PROFILE | Split-Path) -ErrorAction Ignore ;`
New-Item -ItemType File -Path $PROFILE -ErrorAction Ignore ;`
@'
# Ansible
function ansible {wsl --shell-type login -- ansible @Args}
'@ | Out-File -Append -FilePath $PROFILE
Some tools can be installed on Windows and used from inside the WSL, like bat, fd, and yq.
Install the tools with winget
,
winget install sharkdp.bat sharkdp.fd MikeFarah.yq
Then, set their aliases on ~/.zshrc
or ~/.bashrc
inside the WSL distro,
for bin in bat eza yq ; do
which ${bin}.exe &>/dev/null && alias ${bin}="${bin}.exe"
done