From d881ab0eba27e82f5fe0a282592cd30e58bd0831 Mon Sep 17 00:00:00 2001 From: neingeist Date: Tue, 2 Sep 2025 21:11:31 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20support=20for=20debian=2013?= =?UTF-8?q?=20trixie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasks/debian-12-or-earlier.yml | 5 +++++ tasks/debian-13-or-later.yml | 15 +++++++++++++++ tasks/main.yml | 23 ++++++++--------------- tasks/remove-obsolete-apt-lists.yml | 13 +++++++++++++ 4 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 tasks/debian-12-or-earlier.yml create mode 100644 tasks/debian-13-or-later.yml create mode 100644 tasks/remove-obsolete-apt-lists.yml diff --git a/tasks/debian-12-or-earlier.yml b/tasks/debian-12-or-earlier.yml new file mode 100644 index 0000000..4dcad06 --- /dev/null +++ b/tasks/debian-12-or-earlier.yml @@ -0,0 +1,5 @@ +- name: install backports apt list + template: + src: backports.list.j2 + dest: /etc/apt/sources.list.d/backports.list + # do this from a template to fully remove any other lines in the file. diff --git a/tasks/debian-13-or-later.yml b/tasks/debian-13-or-later.yml new file mode 100644 index 0000000..00bda10 --- /dev/null +++ b/tasks/debian-13-or-later.yml @@ -0,0 +1,15 @@ +- name: add backports apt repo + deb822_repository: + name: backports + types: + - deb + - deb-src + uris: http://deb.debian.org/debian/ + suites: "{{ ansible_distribution_release }}-backports" + components: + - main + - contrib + - non-free + - non-free-firmware + signed_by: /usr/share/keyrings/debian-archive-keyring.gpg + diff --git a/tasks/main.yml b/tasks/main.yml index be0c134..a7eb694 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,20 +1,13 @@ -- name: install backports apt list - template: - src: backports.list.j2 - dest: /etc/apt/sources.list.d/backports.list - # do this from a template to fully remove any other lines in the file. +- fail: + msg: "only supported on debian" + when: not ansible_distribution in ["Debian"] -- name: remove obsolete apt lists - file: path=/etc/apt/sources.list.d/{{ item }}-backports.list state=absent - with_items: - - jessie - - stretch -- name: remove obsolete apt list entries - lineinfile: path=/etc/apt/sources.list regexp="{{ item }}-backports" state=absent - with_items: - - jessie - - stretch +- include_tasks: remove-obsolete-apt-lists.yml +- include_tasks: debian-12-or-earlier.yml + when: ansible_distribution_major_version|int <= 12 +- include_tasks: debian-13-or-later.yml + when: ansible_distribution_major_version|int >= 13 - name: update apt cache diff --git a/tasks/remove-obsolete-apt-lists.yml b/tasks/remove-obsolete-apt-lists.yml new file mode 100644 index 0000000..92bd3df --- /dev/null +++ b/tasks/remove-obsolete-apt-lists.yml @@ -0,0 +1,13 @@ +- name: remove obsolete apt lists + file: path=/etc/apt/sources.list.d/{{ item }}-backports.list state=absent + with_items: + - jessie + - stretch +- name: remove obsolete apt list entries + lineinfile: path=/etc/apt/sources.list regexp="{{ item }}-backports" state=absent + with_items: + - jessie + - stretch +- name: remove obsolete backports.list + file: path=/etc/apt/sources.list.d/backports.list state=absent + when: ansible_distribution_major_version|int >= 13