Map all relevant architectures for deb822 repository setup

At the moment we fixup only x86_64 arch while there way more arches
in the wild. So it's worth to have a mapping for architectures in place
rather then maintain quite complex replaces.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-openstack_hosts/+/930272
Related-Bug: #2081764
Change-Id: I471fc337c0f13a5b8b10131760ed96032a34f9e8
This commit is contained in:
Dmitriy Rabotyagov
2024-09-24 11:27:42 +02:00
parent 20b09197a2
commit 494590447e
3 changed files with 11 additions and 6 deletions

View File

@@ -55,6 +55,14 @@ rabbitmq_package_version: "{{ _rabbitmq_package_version }}"
rabbitmq_package_sha256: ""
rabbitmq_package_path: ""
# Mappings from Ansible reported architecture to distro release architecture
rabbitmq_architecture_mapping:
x86_64: amd64
ppc64le: ppc64el
s390x: s390x
armv7l: armhf
aarch64: arm64
# Set the gpg keys needed to be imported
# This should be a list of dicts, with each dict
# giving a set of arguments to the applicable

View File

@@ -54,14 +54,11 @@
name: python3-debian
- name: Manage apt repositories
vars:
_a: "{{ item.architectures }}"
_architecture_fixup: "{{ ((_a | d([])) is iterable and (_a | d([])) is not string) | ternary(_a, [_a]) | map('replace', 'x86_64', 'amd64') }}"
ansible.builtin.deb822_repository:
allow_downgrade_to_insecure: "{{ item.allow_downgrade_to_insecure | default(omit) }}"
allow_insecure: "{{ item.allow_insecure | default(omit) }}"
allow_weak: "{{ item.allow_weak | default(omit) }}"
architectures: "{{ (_architecture_fixup | length > 0) | ternary(_architecture_fixup, omit) }}"
architectures: "{{ item.architectures | default(omit) }}"
by_hash: "{{ item.by_hash | default(omit) }}"
check_date: "{{ item.check_date | default(omit) }}"
check_valid_until: "{{ item.check_valid_until | default(omit) }}"

View File

@@ -23,7 +23,7 @@ _rabbitmq_repo:
uris: "{{ rabbitmq_repo_url }}"
signed_by: "{{ lookup('file', 'gpg/C072C960') }}"
components: main
architectures: "{{ ansible_facts['architecture'] }}"
architectures: "{{ rabbitmq_architecture_mapping.get(ansible_facts['architecture']) }}"
state: "{{ (rabbitmq_install_method == 'external_repo') | ternary('present', 'absent') }}"
_rabbitmq_erlang_repo_url: "https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/{{ ansible_facts['distribution'] | lower }}"
@@ -33,7 +33,7 @@ _rabbitmq_erlang_repo:
uris: "{{ rabbitmq_erlang_repo_url }}"
signed_by: "{{ lookup('file', 'gpg/A16A4251') }}"
components: main
architectures: "{{ ansible_facts['architecture'] }}"
architectures: "{{ rabbitmq_architecture_mapping.get(ansible_facts['architecture']) }}"
state: "{{ (rabbitmq_install_method == 'external_repo') | ternary('present', 'absent') }}"
_rabbitmq_erlang_version_spec: "{{ (rabbitmq_install_method == 'external_repo') | ternary('1:26.2.*-1', '1:24.*') }}"