From faf1c7e36f83406229f877d765b5c2ffe5e6b1b4 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Sat, 28 Nov 2026 15:51:17 +0000 Subject: [PATCH 1/2] ci(molecule): connect over the Docker API with a fixed Python interpreter The docker driver's community.docker.docker connection starts the docker CLI for every task on every host, and each playbook run discovers the interpreter on every container although both molecule images ship /usr/bin/python3. The shared base config now sets provisioner.connection_options, which molecule merges over the driver's own connection vars for the container hosts only, so localhost keeps the controller's Python. community.docker 5.4.1's docker_api connection supports pipelining and become and needs only requests, which requirements-dev.lock already pins. The docker CLI bind mount in molecule.yml stays until a green run shows nothing needs it; its comment and two others that named the CLI's calls now describe the API connection. Closes #455 Assisted-by: Claude Code --- .config/molecule/config.yml | 11 +++++++++-- .gitea/workflows/molecule.yml | 5 +++-- roles/user_management/molecule/default/converge.yml | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.config/molecule/config.yml b/.config/molecule/config.yml index 9bdea86..a5aac40 100644 --- a/.config/molecule/config.yml +++ b/.config/molecule/config.yml @@ -3,10 +3,17 @@ # first on ANSIBLE_COLLECTIONS_PATH, so molecule's per-scenario install is unused. prerun: false provisioner: + # Merged over the docker driver's own connection vars, for the container hosts only: localhost + # keeps the controller's connection and Python. + connection_options: + # Talk to the daemon over its socket, instead of starting the docker CLI for every task. + ansible_connection: community.docker.docker_api + # Both molecule images ship it; a fixed path skips interpreter discovery in every playbook run. + ansible_python_interpreter: /usr/bin/python3 config_options: connection: - # Pipe each module over stdin: without it every task pays extra docker exec and docker cp - # calls to make a temp dir, copy the module in and clean up. + # Pipe each module over stdin: without it every task pays extra exec and copy calls to the + # daemon to make a temp dir, copy the module in and clean up. pipelining: true defaults: # Gather each host's facts once per playbook run, not in every play. diff --git a/.gitea/workflows/molecule.yml b/.gitea/workflows/molecule.yml index 467f866..dbf01ac 100644 --- a/.gitea/workflows/molecule.yml +++ b/.gitea/workflows/molecule.yml @@ -148,8 +148,9 @@ jobs: # As the runner user, with the socket's group, so nothing in the job tree is left root-owned. # HOME (ansible's temp and caches) is in the job tree; a mounted passwd entry points the user - # at it, because ansible's temp path is `~/.ansible/tmp`. The driver's connection plugin - # (community.docker.docker) runs the docker CLI, which the image lacks: the host's goes in. + # at it, because ansible's temp path is `~/.ansible/tmp`. The image lacks the docker CLI + # and the scenarios connect over the socket (docker_api); the host's CLI goes in until a run + # shows nothing needs it. ac_root="$(cd ../../.. && pwd)" sock_gid="$(stat -c %g /var/run/docker.sock)" docker_cli="$(readlink -f "$(command -v docker)")" diff --git a/roles/user_management/molecule/default/converge.yml b/roles/user_management/molecule/default/converge.yml index 33056ce..8f5d579 100644 --- a/roles/user_management/molecule/default/converge.yml +++ b/roles/user_management/molecule/default/converge.yml @@ -1,6 +1,6 @@ --- # ansible_user is a connection variable: under the docker connection it would -# make `docker exec -u ` before the user exists. So the primary user is +# run every exec as before the user exists. So the primary user is # set explicitly instead of through the default ({{ ansible_user }}). # bootstrap.yml: wait_for_connection succeeds over the docker connection, so the # root fallback is never taken. -- 2.43.0 From c109d24229f49362301c1f878f339aa5f4cbef12 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Sat, 28 Nov 2026 16:27:24 +0000 Subject: [PATCH 2/2] ci(molecule): name the issue that removes the docker CLI mount Part of #455 Assisted-by: Claude Code --- .gitea/workflows/molecule.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/molecule.yml b/.gitea/workflows/molecule.yml index dbf01ac..77d70c4 100644 --- a/.gitea/workflows/molecule.yml +++ b/.gitea/workflows/molecule.yml @@ -149,8 +149,8 @@ jobs: # As the runner user, with the socket's group, so nothing in the job tree is left root-owned. # HOME (ansible's temp and caches) is in the job tree; a mounted passwd entry points the user # at it, because ansible's temp path is `~/.ansible/tmp`. The image lacks the docker CLI - # and the scenarios connect over the socket (docker_api); the host's CLI goes in until a run - # shows nothing needs it. + # and the scenarios connect over the socket (docker_api); the host's CLI goes in until #462 + # removes it. ac_root="$(cd ../../.. && pwd)" sock_gid="$(stat -c %g /var/run/docker.sock)" docker_cli="$(readlink -f "$(command -v docker)")" -- 2.43.0