mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-09-07 00:13:14 +00:00
Give each Molecule scenario its own Ansible home
Scenarios install their Galaxy dependencies with `force: true`, so two roles running at once re-extract the same collections and roles into ~/.ansible and pull them out from under each other mid-play. It surfaces as a collection that was working moments earlier going missing: the connection plugin 'community.docker.docker' was not found Found while running five scenarios in parallel, where it cost a run. ANSIBLE_HOME relocates both `collections/` and `roles/`, so one variable covers both halves; the scenarios' ANSIBLE_ROLES_PATH workaround now follows it rather than hardcoding ~/.ansible/roles. Left alone if already set, and unset in CI, where each role runs in its own job and has nothing to collide with. Verified by removing var/molecule-ansible-home entirely and running matrix-alertmanager-receiver from cold: green through idempotence, with the collections and roles landing under the per-role directory - which also shows nothing was quietly relying on the shared ~/.ansible being populated. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEH3vxYSQ5SV4N5z61eyGT
This commit is contained in:
co-authored by
Claude Opus 5
parent
6bdcddb79a
commit
705f561777
@@ -70,6 +70,20 @@ if [ ! -x "${venv_dir}/bin/molecule" ]; then
|
||||
"${venv_dir}/bin/pip" install --quiet -r "${repo_dir}/molecule-shared/requirements.txt"
|
||||
fi
|
||||
|
||||
# Galaxy content is installed with `force: true` on every run, so two scenarios
|
||||
# running at once will re-extract collections and roles into the same directory
|
||||
# and pull them out from under each other mid-play. It shows up as a collection
|
||||
# that was working moments earlier going missing:
|
||||
#
|
||||
# the connection plugin 'community.docker.docker' was not found
|
||||
#
|
||||
# ANSIBLE_HOME relocates both `collections/` and `roles/`, so one variable is
|
||||
# enough to give each role its own. The scenarios' ANSIBLE_ROLES_PATH follows it.
|
||||
#
|
||||
# Unset in CI, where it falls back to ~/.ansible - each role runs in its own job
|
||||
# there, so there is nothing to collide with and nothing to gain from isolation.
|
||||
export ANSIBLE_HOME="${ANSIBLE_HOME:-${repo_dir}/var/molecule-ansible-home/${role}}"
|
||||
|
||||
export MOLECULE_DISTRO="${MOLECULE_DISTRO:-ubuntu2604}"
|
||||
export PY_COLORS="${PY_COLORS:-1}"
|
||||
export ANSIBLE_FORCE_COLOR="${ANSIBLE_FORCE_COLOR:-1}"
|
||||
|
||||
Reference in New Issue
Block a user