From 7f73f730ff8a08b27dd0848bd473207e40e3aea9 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 24 Sep 2024 11:41:19 +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. Related-Bug: #2081764 Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-openstack_hosts/+/930272 Change-Id: Ia695be454060cfcce83e072828db71331c8d6928 --- defaults/main.yml | 8 ++++++++ tasks/ceph_preinstall_apt.yml | 4 +--- vars/debian.yml | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index a432162..571c5e7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -46,6 +46,14 @@ ceph_repo_url_region: "download" # see here for other mirros http://docs.ceph.c ceph_repo_url: https://{{ ceph_repo_url_region }}.ceph.com/{{ _ceph_repo_distro_suffix }}-{{ ceph_stable_release }} ceph_repos: "{{ _ceph_repos }}" +# Mappings from Ansible reported architecture to distro release architecture +ceph_architecture_mapping: + x86_64: amd64 + ppc64le: ppc64el + s390x: s390x + armv7l: armhf + aarch64: arm64 + # Ceph Authentication cephx: true diff --git a/tasks/ceph_preinstall_apt.yml b/tasks/ceph_preinstall_apt.yml index 24608fc..da08a89 100644 --- a/tasks/ceph_preinstall_apt.yml +++ b/tasks/ceph_preinstall_apt.yml @@ -42,8 +42,6 @@ - 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') }}" loop_label: name: "{{ item.name }}" uris: "{{ item.uris | default('') }}" @@ -53,7 +51,7 @@ 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 1efb354..6ae92b4 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -36,5 +36,5 @@ _ceph_repos: uris: "{{ ceph_repo_url }}" signed_by: "{{ lookup('file', 'gpg/460f3994') }}" components: main - architectures: "{{ ansible_facts['architecture'] }}" + architectures: "{{ ceph_architecture_mapping.get(ansible_facts['architecture']) }}" state: "{{ (ceph_pkg_source == 'ceph') | ternary('present', 'absent') }}"