From a0be8a4179ad413e633f01dccf799f0028b2a475 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Fri, 24 Sep 2021 10:45:12 +0100
Subject: [PATCH] Uninstall old float package repositories

Since the repository name changes with the release, the previous
logic would leave float/buster around when float/bullseye was
installed. This change fixes that.
---
 roles/float-base/tasks/apt.yml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/roles/float-base/tasks/apt.yml b/roles/float-base/tasks/apt.yml
index a33f8228..4d72c468 100644
--- a/roles/float-base/tasks/apt.yml
+++ b/roles/float-base/tasks/apt.yml
@@ -52,8 +52,12 @@
 
 - name: Install package repositories
   apt_repository:
-    repo: "deb [signed-by=/usr/share/keyrings/deb.autistici.org.gpg] http://deb.autistici.org/urepo float/{{ float_debian_dist }}/"
-    state: present
+    repo: "deb [signed-by=/usr/share/keyrings/deb.autistici.org.gpg] http://deb.autistici.org/urepo float/{{ item }}/"
+    state: "{{ 'present' if item == float_debian_dist else 'absent' }}"
+  loop:
+    - stretch
+    - buster
+    - bullseye
 
 - name: Run apt-get update
   apt:
-- 
GitLab