From be0fa13c16165635db18e98a865af0dafa73790b Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Sun, 6 Aug 2023 11:00:54 +0200 Subject: [PATCH] Add no-snap --- roles/no-snap/files/etc/apt/preferences.d/no-snap | 6 ++++++ roles/no-snap/tasks/main.yml | 14 ++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 roles/no-snap/files/etc/apt/preferences.d/no-snap create mode 100644 roles/no-snap/tasks/main.yml diff --git a/roles/no-snap/files/etc/apt/preferences.d/no-snap b/roles/no-snap/files/etc/apt/preferences.d/no-snap new file mode 100644 index 0000000..08b8715 --- /dev/null +++ b/roles/no-snap/files/etc/apt/preferences.d/no-snap @@ -0,0 +1,6 @@ +# To prevent repository packages from triggering the installation of snap, +# this file forbids snapd from being installed by APT. + +Package: snapd +Pin: release a=* +Pin-Priority: -10 diff --git a/roles/no-snap/tasks/main.yml b/roles/no-snap/tasks/main.yml new file mode 100644 index 0000000..ef7cf0e --- /dev/null +++ b/roles/no-snap/tasks/main.yml @@ -0,0 +1,14 @@ +- name: remove snap + become: yes + apt: + state: absent + purge: yes + pkg: + - snapd + +- name: Forbid apt to install snap + become: yes + copy: + src: etc/apt/preferences.d/no-snap + dest: /etc/apt/preferences.d/no-snap + mode: '0644'