Files
Dragonish ba96e98585
Build / build (pull_request) Successful in 19s
Molecule / molecule (pull_request) Canceled after 0s
Lint / lint (pull_request) Canceled after 25s
feat(docker): derive the apt architecture from the host
docker_apt_arch defaults to empty, which derives amd64 or arm64 from
the host architecture; another architecture fails the play, and a set
value is always used.

Assisted-by: Claude Code
2026-11-23 19:30:31 +00:00

24 lines
1.2 KiB
YAML

---
# Fact-computing and assertion only, before any task changes the host. A removal does not write the apt source, so it does not need the architecture.
- name: Work out the apt architecture
ansible.builtin.set_fact:
__docker_apt_arch: >-
{{ docker_apt_arch | default('', true) or __docker_arch_by_fact[ansible_facts['architecture'] | default('')] | default('', true) }}
tags: always
# The value is written into the one-line apt source (deb [arch=... signed-by=...]): a space or a bracket would corrupt it.
- name: Check the apt architecture
ansible.builtin.assert:
that:
- __docker_apt_arch is match('^[a-z0-9]+\Z')
fail_msg: >-
{% if docker_apt_arch | default('', true) | length > 0 %}
docker_apt_arch '{{ docker_apt_arch }}' is not a valid apt architecture name: use the name Docker publishes (for example amd64 or arm64),
lowercase letters and digits only.
{% else %}
The host architecture '{{ ansible_facts['architecture'] | default('unknown') }}' has no known Docker apt architecture (x86_64 and aarch64 do).
Set docker_apt_arch to the name Docker publishes for it, for example armhf.
{% endif %}
quiet: true
tags: always