ci(molecule): connect over the Docker API with a fixed Python interpreter #463

Open
Claude wants to merge 2 commits from ci/455-docker-api-connection into main
pull from: ci/455-docker-api-connection
Owner

What and why

Closes #455

  • .config/molecule/config.yml sets provisioner.connection_options: ansible_connection: community.docker.docker_api, which talks to the daemon's socket instead of starting the docker CLI for every task, and ansible_python_interpreter: /usr/bin/python3, which skips interpreter discovery in every playbook run. Molecule merges these over the driver's own connection vars on the container hosts only, so localhost keeps the controller's Python.
  • The docker CLI bind mount stays; #462 removes it after this has a green run. Its comment, and one in the user_management scenario, described the CLI connection's calls and now describe the API connection. #455 asked to leave the CLI comment in place, but its old text would have been false.

Verified

  • pre-commit run --all-files and python3 -m unittest discover -s tests/scripts pass, and ansible-test sanity passed on push.
  • Read in the sources: molecule 26.11.0 merges connection_options over the driver's and writes them as host vars on the platform hosts only. No scenario sets its own connection or interpreter vars. community.docker 5.4.1's docker_api supports pipelining and become, maps ansible_user to the exec user as the CLI plugin did, uses the default socket when DOCKER_HOST is unset, and needs requests and urllib3, which requirements-dev.lock pins for the ci image. delegate_to: localhost tasks keep the controller's connection and Python.
  • A rendered sshd scenario gives both hosts the new connection and interpreter.

Not verified

  • Whether every scenario passes on docker_api, and the wall-clock change: this PR's Molecule run shows both, compared against run 6363 (4 lanes, 35 min 0 s, on the CLI connection).

  • I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.

Assisted-by: Claude Code

## What and why Closes #455 - `.config/molecule/config.yml` sets `provisioner.connection_options`: `ansible_connection: community.docker.docker_api`, which talks to the daemon's socket instead of starting the docker CLI for every task, and `ansible_python_interpreter: /usr/bin/python3`, which skips interpreter discovery in every playbook run. Molecule merges these over the driver's own connection vars on the container hosts only, so localhost keeps the controller's Python. - The docker CLI bind mount stays; #462 removes it after this has a green run. Its comment, and one in the `user_management` scenario, described the CLI connection's calls and now describe the API connection. #455 asked to leave the CLI comment in place, but its old text would have been false. ## Verified - `pre-commit run --all-files` and `python3 -m unittest discover -s tests/scripts` pass, and `ansible-test sanity` passed on push. - Read in the sources: molecule 26.11.0 merges `connection_options` over the driver's and writes them as host vars on the platform hosts only. No scenario sets its own connection or interpreter vars. community.docker 5.4.1's `docker_api` supports pipelining and become, maps `ansible_user` to the exec user as the CLI plugin did, uses the default socket when `DOCKER_HOST` is unset, and needs `requests` and `urllib3`, which `requirements-dev.lock` pins for the ci image. `delegate_to: localhost` tasks keep the controller's connection and Python. - A rendered `sshd` scenario gives both hosts the new connection and interpreter. ## Not verified - Whether every scenario passes on `docker_api`, and the wall-clock change: this PR's Molecule run shows both, compared against run 6363 (4 lanes, 35 min 0 s, on the CLI connection). --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. Assisted-by: Claude Code
Claude added this to the CI velocity (emergency) milestone 2026-11-28 16:31:21 +00:00
Claude added 2 commits 2026-11-28 16:31:21 +00:00
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
ci(molecule): name the issue that removes the docker CLI mount
Build / build (pull_request) Successful in 38s
Molecule / molecule (pull_request) In progress
Lint / lint (pull_request) Successful in 3m24s
c109d24229
Part of #455

Assisted-by: Claude Code
CODEOWNERS rules requested review from Defame1297 2026-11-28 16:31:21 +00:00
Some checks are pending
Build / build (pull_request) Successful in 38s
Required
Details
Molecule / molecule (pull_request) In progress
Required
Details
Lint / lint (pull_request) Successful in 3m24s
Required
Details
Some required checks are missing.
This pull request has official review requests.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin ci/455-docker-api-connection:ci/455-docker-api-connection
git checkout ci/455-docker-api-connection
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#463