Skip to content

Instantly share code, notes, and snippets.

@aheil
Created November 9, 2019 22:21
Show Gist options
  • Save aheil/6d48a77ac44c83e00666d3c49ffd7890 to your computer and use it in GitHub Desktop.
Save aheil/6d48a77ac44c83e00666d3c49ffd7890 to your computer and use it in GitHub Desktop.
Ansible task to upgrade Windows WSL 1.x Ubunto to latest release
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # #
# # Upgrade Windows WSL 1.x Ubunto to latest release # #
# # # #
# # Upgrade process based on: # #
# # https://medium.com/@rockey5520/wsl-ubuntu-upgrade-to-disco-dingo-19-04-b4abff20452d # #
# # # #
# # Created: 2019/11/01 23:54:53 # #
# # Last modified: # #
# # # #
# # Run this playbook with 'sudo ansible-playbook ...' # #
# # # #
# # To check if the upgrade run 'lsb_release -a' # #
# # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# prepare by making sure /etc/update-manager/release-upgrades contains Prompt=normal
# insted of Prompt=LTS etc.
- name: set release upgrades to normal
lineinfile:
path: /etc/update-manager/release-upgrades
regexp: '^Prompt='
line: Prompt=normal
tags:
- wsl_distupgrade
# run apt-get update at least once an hour (keep chache for 3.600 sec)
- name: apt-get update as separate step
apt:
update_cache: yes
cache_valid_time: 3600
tags:
- wsl_distupgrade
# as snap store is not supported in WSL 1.x and creates probblems during upgrade
- name: remove lxd
apt:
name: lxd
state: absent
autoremove: yes
tags:
- wsl_distupgrade
# same is for lxd-client
- name: remove lxd-client
apt:
name: lxd-client
state: absent
# force: yes
autoremove: yes
tags:
- wsl_distupgrade
# upgrade all packages, remove all unecessary packages
- name: run apt-get upgrade
apt:
upgrade: yes
autoremove: yes
tags:
- wsl_distupgrade
# upgrade all packages and update handle dependencies
- name: run apt-get dist-upgrade
apt:
upgrade: dist
autoremove: yes
tags:
- wsl_distupgrade
# run the release upgrade
- name: run do-release-upgrade non-interactively
command: do-release-upgrade -f DistUpgradeViewNonInteractive
tags:
- wsl_distupgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment