From 2ff72068dbe04d03027aa1cf5b138321f696f1ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Els=C5=91=20Andr=C3=A1s?= Date: Thu, 11 Dec 2025 09:23:34 +0100 Subject: [PATCH 1/2] Cleanup old repository --- tasks/install_apt.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tasks/install_apt.yml b/tasks/install_apt.yml index 0c6e52b9..68f817b6 100644 --- a/tasks/install_apt.yml +++ b/tasks/install_apt.yml @@ -37,6 +37,16 @@ creates: /usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg when: ansible_facts['pkg_mgr'] == 'apt' +# --- Remove old repository file --- +# We use a new repo file in next task +- name: PostgreSQL | Remove old PostgreSQL repository | apt + apt_repository: + repo: "{{ postgresql_apt_repository }}" + state: absent + when: + - ansible_facts['pkg_mgr'] == 'apt' + - (postgresql_install_repository | default(true)) | bool + # --- Add the PGDG APT repository (HTTPS + signed-by) --- # We explicitly build the repo line to ensure the correct suite and signed-by usage. - name: Add PGDG APT repository From 2ea47c3482f104f603727fca0c240f5f422417a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Els=C5=91=20Andr=C3=A1s?= Date: Mon, 15 Dec 2025 11:49:53 +0100 Subject: [PATCH 2/2] Use the old postgresql_apt_repository string --- tasks/install_apt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/install_apt.yml b/tasks/install_apt.yml index 68f817b6..0a1b6b77 100644 --- a/tasks/install_apt.yml +++ b/tasks/install_apt.yml @@ -41,7 +41,7 @@ # We use a new repo file in next task - name: PostgreSQL | Remove old PostgreSQL repository | apt apt_repository: - repo: "{{ postgresql_apt_repository }}" + repo: "deb http://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main {{ postgresql_version }}" state: absent when: - ansible_facts['pkg_mgr'] == 'apt'