From 09ae63d721c751eaf9e8f240c182c66cd7558963 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 24 Sep 2024 10:36:51 +0200 Subject: [PATCH] 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 --- defaults/main.yml | 8 ++++++++ tasks/openstack_hosts_configure_apt.yml | 6 +----- vars/debian.yml | 2 +- vars/ubuntu.yml | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index c8726388..9a17ab62 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/tasks/openstack_hosts_configure_apt.yml b/tasks/openstack_hosts_configure_apt.yml index fbd101b0..e3be72ab 100644 --- a/tasks/openstack_hosts_configure_apt.yml +++ b/tasks/openstack_hosts_configure_apt.yml @@ -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) }}" diff --git a/vars/debian.yml b/vars/debian.yml index ea092b3c..9c3c73b0 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -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 diff --git a/vars/ubuntu.yml b/vars/ubuntu.yml index e9661237..bf013d15 100644 --- a/vars/ubuntu.yml +++ b/vars/ubuntu.yml @@ -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