Remove old repos for Debian

It appears that old repo must be removed explicitly and apt_repository
don't have an option for exclusive content when filename defined
So we need to drop old repo after switching to cloudsmith to avoid
fetching data from them and make repos clean during upgrade.

Change-Id: Iffb5dd5f9a1937825e2cc345b720d7af072608c1
This commit is contained in:
Dmitriy Rabotyagov 2022-02-01 11:08:19 +02:00
parent 9355e52547
commit 3a735007c6

View File

@ -74,6 +74,24 @@
tags:
- rabbitmq-repos
# NOTE(noonedeadpunk): Remove this after Z release
- name: Remove old repos
apt_repository:
repo: "{{ item.repo }}"
state: absent
filename: "{{ item.filename | default(omit) }}"
update_cache: no
with_items:
- repo: "deb https://packagecloud.io/rabbitmq/rabbitmq-server/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] | lower }} main"
filename: "{{ rabbitmq_repo.filename | default(omit) }}"
condition: "{{ (rabbitmq_install_method == 'external_repo') }}"
- repo: "deb https://packages.erlang-solutions.com/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] | lower }} contrib"
filename: "{{ rabbitmq_erlang_repo.filename | default(omit) }}"
condition: "{{ (rabbitmq_erlang_install_method == 'external_repo') }}"
when:
- item.condition | default(True)
- rabbitmq_upgrade | bool
# Due to our Ansible strategy, a skipped task does not
# have a dictionary result, so we have to cater to the
# situation where either of the apt_repository tasks