ci(molecule): connect over the Docker API with a fixed Python interpreter #463
No files matched your search
@@ -3,10 +3,17 @@
|
|||||||
# first on ANSIBLE_COLLECTIONS_PATH, so molecule's per-scenario install is unused.
|
# first on ANSIBLE_COLLECTIONS_PATH, so molecule's per-scenario install is unused.
|
||||||
prerun: false
|
prerun: false
|
||||||
provisioner:
|
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:
|
config_options:
|
||||||
connection:
|
connection:
|
||||||
# Pipe each module over stdin: without it every task pays extra docker exec and docker cp
|
# Pipe each module over stdin: without it every task pays extra exec and copy calls to the
|
||||||
# calls to make a temp dir, copy the module in and clean up.
|
# daemon to make a temp dir, copy the module in and clean up.
|
||||||
pipelining: true
|
pipelining: true
|
||||||
defaults:
|
defaults:
|
||||||
# Gather each host's facts once per playbook run, not in every play.
|
# Gather each host's facts once per playbook run, not in every play.
|
||||||
|
|||||||
@@ -148,8 +148,9 @@ jobs:
|
|||||||
|
|
||||||
# As the runner user, with the socket's group, so nothing in the job tree is left root-owned.
|
# 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
|
# 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 `~<user>/.ansible/tmp`. The driver's connection plugin
|
# at it, because ansible's temp path is `~<user>/.ansible/tmp`. The image lacks the docker CLI
|
||||||
# (community.docker.docker) runs the docker CLI, which the image lacks: the host's goes in.
|
# and the scenarios connect over the socket (docker_api); the host's CLI goes in until #462
|
||||||
|
# removes it.
|
||||||
ac_root="$(cd ../../.. && pwd)"
|
ac_root="$(cd ../../.. && pwd)"
|
||||||
sock_gid="$(stat -c %g /var/run/docker.sock)"
|
sock_gid="$(stat -c %g /var/run/docker.sock)"
|
||||||
docker_cli="$(readlink -f "$(command -v docker)")"
|
docker_cli="$(readlink -f "$(command -v docker)")"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
# ansible_user is a connection variable: under the docker connection it would
|
# ansible_user is a connection variable: under the docker connection it would
|
||||||
# make `docker exec -u <user>` before the user exists. So the primary user is
|
# run every exec as <user> before the user exists. So the primary user is
|
||||||
# set explicitly instead of through the default ({{ ansible_user }}).
|
# set explicitly instead of through the default ({{ ansible_user }}).
|
||||||
# bootstrap.yml: wait_for_connection succeeds over the docker connection, so the
|
# bootstrap.yml: wait_for_connection succeeds over the docker connection, so the
|
||||||
# root fallback is never taken.
|
# root fallback is never taken.
|
||||||
|
|||||||
Reference in new issue
Block a user