From 502ba663c555b848efd5a7e5b4c13c217b37b75e Mon Sep 17 00:00:00 2001 From: ChengHao Yang <17496418+tico88612@users.noreply.github.com> Date: Thu, 7 Aug 2025 11:26:45 +0800 Subject: [PATCH] Fix: Convert -backports sources to archive.debian.org for bullseye and older (#12434) Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com> --- roles/container-engine/docker/tasks/main.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/roles/container-engine/docker/tasks/main.yml b/roles/container-engine/docker/tasks/main.yml index 46f3bce88..62293264d 100644 --- a/roles/container-engine/docker/tasks/main.yml +++ b/roles/container-engine/docker/tasks/main.yml @@ -60,16 +60,17 @@ environment: "{{ proxy_env }}" when: ansible_pkg_mgr == 'apt' -# ref to https://github.com/kubernetes-sigs/kubespray/issues/11086 -- name: Remove the archived debian apt repository - lineinfile: - path: /etc/apt/sources.list - regexp: 'buster-backports' - state: absent +# ref to https://github.com/kubernetes-sigs/kubespray/issues/11086 & 12424 +- name: Convert -backports sources to archive.debian.org for bullseye and older + replace: + path: "{{ item }}" + regexp: '^(deb(?:-src)?\s+)(?:https?://)?(?:[^ ]+debian\.org)?([^ ]*/debian)(\s+{{ ansible_distribution_release }}-backports\b.*)' + replace: '\1http://archive.debian.org/debian\3' backup: true + loop: "{{ query('fileglob', '/etc/apt/sources.list') }}" when: - ansible_os_family == 'Debian' - - ansible_distribution_release == "buster" + - ansible_distribution_release in ['bullseye', 'buster'] - name: Ensure docker-ce repository is enabled apt_repository: