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.

Closes-Bug: #2081764
Change-Id: I2b9e65a533789f92d6dd7b8059e21268e4a39ab7
This commit is contained in:
Dmitriy Rabotyagov 2024-09-24 10:36:51 +02:00
parent e3e79ff601
commit 09ae63d721
4 changed files with 11 additions and 7 deletions

@ -74,6 +74,14 @@ openstack_hosts_package_vendors: "{{ (_package_vendors | default([])) + (user_ex
# named user_external_repo_keys_list and the standard defaults _package_repos_keys
openstack_hosts_package_repos_keys: "{{ _package_repos_keys + (user_external_repo_keys_list | default([])) }}"
# Mappings from Ansible reported architecture to distro release architecture
openstack_architecture_mapping:
x86_64: amd64
ppc64le: ppc64el
s390x: s390x
armv7l: armhf
aarch64: arm64
# The following garbage collection values are set to better support lots of neutron networks/routers.
# Used for setting the net.ipv4/6.neigh.default.gc_thresh* values. This assumes that facts were
# gathered to obtain the total amount of memory available on a given host. If no facts are gathered

@ -54,15 +54,11 @@
delay: 2
- name: Manage apt repositories
vars:
# map x86_64 to amd64 handling both a single string and list of architectures
_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) }}"

@ -87,7 +87,7 @@ _package_repos:
uris: "{{ apt_repo_url | default('http://osbpo.debian.net/osbpo') }}"
signed_by: "{{ lookup('file', 'gpg/FEE4EECB') }}"
components: main
architectures: "{{ ansible_facts['architecture'] }}"
architectures: "{{ openstack_architecture_mapping.get(ansible_facts['architecture']) }}"
state: present
_openstack_ca_bundle_path: /etc/ssl/certs/ca-certificates.crt

@ -90,7 +90,7 @@ _package_repos:
uris: "{{ apt_repo_url | default('http://ubuntu-cloud.archive.canonical.com/ubuntu') }}"
signed_by: /usr/share/keyrings/ubuntu-cloud-keyring.gpg
components: main
architectures: "{{ ansible_facts['architecture'] }}"
architectures: "{{ openstack_architecture_mapping.get(ansible_facts['architecture']) }}"
state: present
_openstack_ca_bundle_path: /etc/ssl/certs/ca-certificates.crt