Merge branch 'main' into ci/244-refuse-claude-md
Build / build (pull_request) Successful in 16s
Molecule / molecule (pull_request) Successful in 2s
Lint / lint (pull_request) Successful in 1m23s

This commit is contained in:
Defame1297 committed 2026-11-23 19:53:12 +00:00
commit 5d2f6ffad2
11 files changed
+78 -8

No files matched your search

+1 -1
View File
@@ -70,7 +70,7 @@ jobs:
# Used by the scenarios as `image: ${MOLECULE_IMAGE}`; set it the same way to run
# one locally.
MOLECULE_IMAGE: >-
git.rkdr.net/mortis/molecule-ubuntu2404:0.1.8@sha256:e1ea7c6f953626c39d9f578d60a1ef668f09ed4e5d537d5c7601668b5c5e0eb3
git.rkdr.net/mortis/molecule-ubuntu2404:0.1.9@sha256:2687d921fdcadf49c36bd7a3b01eaf5f2a53fa0e8f9ed91b2c7ab0631022193b
# The same for Ubuntu 26.04, the release the hosts are moving to; used by
# `image: ${MOLECULE_IMAGE_2604}` in extensions/molecule/image-smoke-2604.
MOLECULE_IMAGE_2604: >-
@@ -0,0 +1,7 @@
---
minor_changes:
- >-
docker - ``docker_apt_arch`` now defaults to an empty value that derives the apt architecture from the host (``x86_64`` gives ``amd64``,
``aarch64`` gives ``arm64``) instead of always writing ``amd64``, so an arm64 host no longer needs an override. A value set in the inventory
is used as before. A host with any other architecture fails the play with a message that names ``docker_apt_arch`` instead of getting an
``amd64`` source line that its apt cannot use; set ``docker_apt_arch`` for such a host.
+2 -2
View File
@@ -4,7 +4,7 @@ Installs Docker Engine from the upstream Docker APT repository, optionally updat
## Supported platforms
Ubuntu. The key and repository URLs point at `download.docker.com/linux/ubuntu`, and the source line uses `ansible_distribution_release`. The default architecture is `amd64`. A limited molecule scenario covers the role's own logic (see [Tests](#tests)); the real Docker Engine is not tested.
Ubuntu. The key and repository URLs point at `download.docker.com/linux/ubuntu`, and the source line uses `ansible_distribution_release`. The apt architecture is derived from the host (`x86_64` gives `amd64`, `aarch64` gives `arm64`); any other architecture fails the play until `docker_apt_arch` is set. A limited molecule scenario covers the role's own logic (see [Tests](#tests)); the real Docker Engine is not tested.
## Requirements and run order
@@ -25,7 +25,7 @@ Ubuntu. The key and repository URLs point at `download.docker.com/linux/ubuntu`,
| `docker_apt_list_path` | `/etc/apt/sources.list.d/docker.list` | no | APT source file. |
| `docker_gpg_url` | `https://download.docker.com/linux/ubuntu/gpg` | no | Key URL. |
| `docker_repo_base_url` | `https://download.docker.com/linux/ubuntu` | no | Repository base URL. |
| `docker_apt_arch` | `amd64` | no | Architecture in the APT source. |
| `docker_apt_arch` | derived from the host | no | Architecture in the APT source. Empty derives it (`x86_64` gives `amd64`, `aarch64` gives `arm64`); another architecture fails until this is set. A value set here is always used; lowercase letters and digits only. |
| `docker_service` | `docker` | no | systemd unit name. |
| `docker_group` | `docker` | no | Group for `docker_users`. |
| `docker_users` | `[]` | no | Users added to the group. |
+3 -2
View File
@@ -13,8 +13,9 @@ docker_apt_list_path: /etc/apt/sources.list.d/docker.list
docker_gpg_url: https://download.docker.com/linux/ubuntu/gpg
docker_repo_base_url: https://download.docker.com/linux/ubuntu
# Override per host if a host is not amd64.
docker_apt_arch: amd64
# Architecture written into the APT source. Empty (the default) derives it from the host: x86_64 gives amd64, aarch64 gives arm64, any
# other architecture fails the play, so set it here (for example armhf) when Docker publishes one for it.
docker_apt_arch: ""
docker_service: docker
docker_group: docker
+5 -2
View File
@@ -56,9 +56,12 @@ argument_specs:
- Base URL of the repository. The source line uses C(ansible_distribution_release) and the C(stable) component.
docker_apt_arch:
type: str
default: amd64
default: ""
description:
- Architecture written into the APT source. Override per host if a host is not amd64.
- >-
Architecture written into the APT source. Empty (the default) derives it from the host: C(x86_64) gives C(amd64), C(aarch64)
gives C(arm64). Any other host architecture fails the play, so set this to the name Docker publishes for it. Lowercase letters
and digits only. A value set here is always used.
docker_service:
type: str
default: docker
@@ -59,3 +59,27 @@
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
- "'docker_remove' in ansible_failed_result.msg | default('')"
quiet: true
# The architecture is written into the one-line apt source, so a value with a space or a bracket is refused before anything
# changes. The derived default is covered by the converge above and verify.yml (the container is x86_64, so the source says amd64).
- name: A docker_apt_arch value that would corrupt the apt source is refused
hosts: all
gather_facts: false
vars:
docker_apt_arch: "bad arch"
tasks:
- name: Apply the role with a bad architecture
block:
- name: Include the role
ansible.builtin.include_role:
name: mortis.kamino.docker
- name: Fail when the bad architecture was accepted
ansible.builtin.fail:
msg: MOLECULE-ACCEPTED
rescue:
- name: The validation stopped the play
ansible.builtin.assert:
that:
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
- "'docker_apt_arch' in ansible_failed_result.msg | default('')"
quiet: true
+1
View File
@@ -17,6 +17,7 @@
- /srv/docker-stub-repo/docker.asc
register: docker_verify_files
# amd64 because the Molecule container is x86_64: the role derives the architecture from the host now.
- name: The source line carries the arch, the keyring and the release
ansible.builtin.assert:
that:
+1 -1
View File
@@ -30,7 +30,7 @@
ansible.builtin.copy:
dest: "{{ docker_apt_list_path }}"
content: |
deb [arch={{ docker_apt_arch }} signed-by={{ docker_keyring_path }}] {{ docker_repo_base_url }} {{ ansible_distribution_release }} stable
deb [arch={{ __docker_apt_arch }} signed-by={{ docker_keyring_path }}] {{ docker_repo_base_url }} {{ ansible_distribution_release }} stable
mode: "0644"
tags: [docker, install]
+5
View File
@@ -1,4 +1,9 @@
---
- name: Validate inputs
ansible.builtin.import_tasks: validate.yml
when: not (docker_remove | default(false) | bool)
tags: always
- name: Remove Docker (explicit only)
ansible.builtin.include_tasks: remove.yml
when: docker_remove | default(false) | bool
+23
View File
@@ -0,0 +1,23 @@
---
# 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
+6
View File
@@ -0,0 +1,6 @@
---
# Constants, not inputs: the Docker apt architecture for each ansible_facts['architecture'] the role derives it for. docker_apt_arch
# overrides it for any other architecture.
__docker_arch_by_fact:
x86_64: amd64
aarch64: arm64