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
This commit is contained in:
Dmitriy Rabotyagov 2024-09-24 11:41:19 +02:00
parent f5a85695e5
commit 7f73f730ff
3 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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) }}"

View File

@ -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') }}"