Skip to content

test(ci): wire multi-role molecule scenario into pull-request CI#101

Merged
sbaerlocher merged 6 commits into
mainfrom
test/multi-role-ci
Jun 27, 2026
Merged

test(ci): wire multi-role molecule scenario into pull-request CI#101
sbaerlocher merged 6 commits into
mainfrom
test/multi-role-ci

Conversation

@sbaerlocher

Copy link
Copy Markdown
Member

Summary

Adds a molecule-multi-role job to pull-request.yml so the combined scenario extensions/molecule/multi-role/ (alloy + do + tailscale on one host, added in #98) runs automatically on every PR. Docker driver, matching the do/tailscale per-role jobs. Documents the combined scenario in AGENTS.md.

Why

The multi-role scenario existed but was never wired into CI, so the cross-role interaction was only testable manually. Closes the Notion intake card "Integrationstest fuer Multi-Rollen-Playbook".

Test plan

  • CI green, molecule-multi-role job converges + verifies all three roles

sbaerlocher added a commit that referenced this pull request Jun 26, 2026
The molecule-multi-role CI job failed in the syntax step with
"The role 'arillso.agent.alloy' was not found". Under
scenarios_root: extensions/molecule the reusable CI runs
ansible-playbook --syntax-check from the extensions/ project
directory, and Ansible's static `roles:` pre-parse does not add the
collection root to the roles search path there — it only lists the
scenario-local roles/ dir plus the galaxy defaults, so the
arillso.agent.<role> FQCNs do not resolve at syntax time.

The per-role default scenarios avoid this because their project
directory is roles/<role>, but they reference their own role with the
same FQCN. To stay consistent with FQCN usage while fixing resolution,
load the three roles via ansible.builtin.include_role instead of a
static roles: block. include_role defers FQCN resolution to converge
runtime, where molecule's prerun has the collection on the finder
path. The pull-request.yml job definition is unchanged.

Refs #101

Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
The combined multi-role scenario (extensions/molecule/multi-role,
added in #98) deploys alloy, do and tailscale on one host but was not
run automatically. Add a molecule-multi-role job (docker driver, like
the do/tailscale per-role jobs) so the cross-role interaction is
covered on every PR. Document it in AGENTS.md.

Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
The molecule-multi-role CI job failed in the syntax step with
"The role 'arillso.agent.alloy' was not found". Under
scenarios_root: extensions/molecule the reusable CI runs
ansible-playbook --syntax-check from the extensions/ project
directory, and Ansible's static `roles:` pre-parse does not add the
collection root to the roles search path there — it only lists the
scenario-local roles/ dir plus the galaxy defaults, so the
arillso.agent.<role> FQCNs do not resolve at syntax time.

The per-role default scenarios avoid this because their project
directory is roles/<role>, but they reference their own role with the
same FQCN. To stay consistent with FQCN usage while fixing resolution,
load the three roles via ansible.builtin.include_role instead of a
static roles: block. include_role defers FQCN resolution to converge
runtime, where molecule's prerun has the collection on the finder
path. The pull-request.yml job definition is unchanged.

Refs #101

Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
The reusable CI runs molecule from `extensions/` (cd dirname of
scenarios_root), so Ansible's cwd-based collection autodetection does
not reach the collection root and arillso.agent.<role> stays unresolved
at converge runtime. Point ANSIBLE_COLLECTIONS_PATH at the dir that
contains ansible_collections/ (four levels up from the extensions cwd).

Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
molecule runs molecule.yml through string placeholder substitution, so
a literal $(...) in a comment raises 'Invalid placeholder in string'.
Reword the comment without dollar signs; the ANSIBLE_COLLECTIONS_PATH
value itself is a plain relative path.

Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
Overriding ANSIBLE_COLLECTIONS_PATH with only the collection-root
parent hid the galaxy-installed deps (community.docker, used by
molecule's own docker create/destroy playbooks), causing
'couldn't resolve community.docker.docker_container'. Append the
default ~/.ansible/collections to the colon-separated list.

Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
…CTORY

A relative ANSIBLE_COLLECTIONS_PATH resolved differently per molecule
phase (molecule changes cwd), so converge still failed to find
arillso.agent.<role>. Use the absolute collection root that molecule
exposes as MOLECULE_PROJECT_DIRECTORY, three levels up to the dir
containing ansible_collections/, plus the default galaxy path for
community.docker.

Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
@sbaerlocher sbaerlocher merged commit a3bc71b into main Jun 27, 2026
25 of 26 checks passed
@sbaerlocher sbaerlocher deleted the test/multi-role-ci branch June 27, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant