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.

Related-Bug: #2081764
Change-Id: Ic1582465c7c822a1f41bf7acd06e154b7bc238b3
This commit is contained in:
Dmitriy Rabotyagov 2024-09-24 11:22:15 +02:00
parent c10ce105e6
commit e5b4fd0d55
3 changed files with 10 additions and 5 deletions

View File

@ -53,6 +53,14 @@ galera_repo_url: "{{ _galera_repo_url }}"
# Set the repo information for the MariaDB repository
galera_repo: "{{ _galera_repo }}"
# Mappings from Ansible reported architecture to distro release architecture
galera_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

@ -42,14 +42,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

@ -77,7 +77,7 @@ _galera_repo:
uris: "{{ galera_repo_url }}"
signed_by: "{{ lookup('file', 'gpg/C74CD1D8') }}"
components: main
architectures: "{{ ansible_facts['architecture'] }}"
architectures: "{{ galera_architecture_mapping.get(ansible_facts['architecture']) }}"
state: "{{ (galera_install_method == 'external_repo') | ternary('present', 'absent') }}"
galera_wsrep_provider: "/usr/lib/galera/libgalera_smm.so"