From 7288a85e7279ca451ae4636e2c1ddb15f573223b Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sat, 25 Apr 2020 10:02:52 +0300 Subject: [PATCH] roles/common: Remove snaps on Ubuntu 20.04 The list of pre-installed snaps and system packages is different on Ubuntu 20.04 than it was in previous LTS releases. See: https://www.kevin-custer.com/blog/disabling-snaps-in-ubuntu-20-04/ --- roles/common/tasks/packages_Ubuntu.yml | 29 +++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/roles/common/tasks/packages_Ubuntu.yml b/roles/common/tasks/packages_Ubuntu.yml index 882b589..ccc9b89 100644 --- a/roles/common/tasks/packages_Ubuntu.yml +++ b/roles/common/tasks/packages_Ubuntu.yml @@ -29,7 +29,21 @@ - name: Install base packages apt: pkg={{ ubuntu_base_packages }} state=present update_cache=yes cache_valid_time=3600 - - name: Set fact for packages to remove + # We have to remove snaps one by one in a specific order because some depend + # on others. Only after that can we remove the corresponding system packages. + - name: Remove lxd snap + snap: name=lxd state=absent + when: ansible_distribution_version is version('20.04', '==') + + - name: Remove core18 snap + snap: name=core18 state=absent + when: ansible_distribution_version is version('20.04', '==') + + - name: Remove snapd snap + snap: name=snapd state=absent + when: ansible_distribution_version is version('20.04', '==') + + - name: Set fact for packages to remove (Ubuntu <= 18.04) set_fact: ubuntu_annoying_packages: - whoopsie # security (CIS 4.1) @@ -43,6 +57,19 @@ - liblxc1 # annoying (Ubuntu >= 16.04) - lxc-common # annoying (Ubuntu >= 16.04) - lxcfs #annoying (Ubuntu >= 16.04) + when: ansible_distribution_version is version('18.04', '<=') + + - name: Set fact for packages to remove (Ubuntu 20.04) + set_fact: + ubuntu_annoying_packages: + - whoopsie # security (CIS 4.1) + - apport # security (CIS 4.1) + - command-not-found # annoying + - command-not-found-data # annoying + - python3-commandnotfound # annoying + - snapd # annoying (Ubuntu >= 16.04) + - lxd-agent-loader # annoying (Ubuntu 20.04) + when: ansible_distribution_version is version('20.04', '==') - name: Remove packages apt: name={{ ubuntu_annoying_packages }} state=absent purge=yes