29 Commits
Author SHA1 Message Date
Defame1297 d3cbcefd54 Merge pull request 'feat(ci): run the molecule scenarios of the roles that use a changed role' (#264) from feat/molecule-role-dependencies into main
Build / build (push) Successful in 14s
Lint / lint (push) Successful in 1m15s
Reviewed-on: #264
2026-11-20 18:45:13 +00:00
Defame1297andClaude Opus 5.5 fcb51da065 feat(ci): run the molecule scenarios of the roles that use a changed role
Build / build (pull_request) Successful in 13s
Lint / lint (pull_request) Successful in 1m1s
Molecule / molecule (pull_request) Successful in 9m45s
The scenario picker assumed the roles were independent and a test enforced it. Wave 2
roles call other Collection roles (traefik includes ufw and the internal _binary_update),
so a change to the called role must also run the callers' scenarios.

A role uses another when a file under its directory names it as mortis.kamino.<role>;
the relation is followed transitively and read from the tree under test. A role the
pull request deletes or renames still counts as used by the roles that name it, so
their scenarios run and show the break.

The independence test becomes a test that fails a bare or templated role name in an
include, import (also in the k=v form), play roles: entry or meta dependency, and task
includes that reach outside the role through '..'. It walks .yml and .yaml files and has
its own cases for each form. This lands before the first such role because the workflow
runs the picker from the base branch's copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-20 18:33:02 +00:00
Defame1297 30ce518f00 Merge pull request 'chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.17.6' (#260) from renovate/astral-sh-ruff-pre-commit-0.x into main
Build / build (push) Successful in 13s
Images / image (Dockerfile, ubuntu:24.04@sha256:73b999393d07f2bf65a40373778a44dc9a6d54ad7718d29247d8ff9413c4d6a8, molecule-ubuntu2404, images/molecule-ubuntu2404, 0.1.8) (push) Successful in 15s
Lint / lint (push) Successful in 49s
Images / image (Dockerfile, ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db, molecule-ubuntu2604, images/molecule-ubuntu2604, 0.1.5) (push) Successful in 12s
Images / image (images/ci/Dockerfile, ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db, ci, , 0.2.29) (push) Successful in 4m57s
Reviewed-on: #260
2026-11-20 17:50:49 +00:00
Defame1297 19b6a8e429 Merge branch 'main' into renovate/astral-sh-ruff-pre-commit-0.x
Build / build (pull_request) Successful in 14s
Lint / lint (pull_request) Successful in 58s
Molecule / molecule (pull_request) Successful in 1s
2026-11-20 17:48:59 +00:00
Defame1297 0435e1e593 Merge pull request 'docs(glossary): hold the three positions per repository' (#261) from docs/glossary-positions-per-repository into main
Build / build (push) Successful in 12s
Lint / lint (push) Successful in 33s
Reviewed-on: #261
2026-11-20 17:48:46 +00:00
Defame1297 fef2c48e94 docs(glossary): hold the three positions per repository
Build / build (pull_request) Successful in 13s
Lint / lint (pull_request) Successful in 33s
Molecule / molecule (pull_request) Successful in 1s
A trusted contributor of another repository in the organisation, such as
the agent skills source, can be a friend or an outsider here: write access
there grants nothing in this repository.

Refs: #249
Assisted-by: Claude Code:claude-opus-5-5
2026-11-20 17:44:15 +00:00
renovate-bot c427e6afd1 chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.17.6
renovate/stability-days Updates have met minimum release age requirement
Build / build (pull_request) Successful in 27s
Lint / lint (pull_request) Successful in 50s
Molecule / molecule (pull_request) Successful in 1s
2026-11-20 03:18:16 +00:00
Defame1297 20781b5465 Merge pull request 'docs(readme): list the shared binary update as internal _binary_update' (#247) from docs/roadmap-internal-binary-update into main
Build / build (push) Successful in 12s
Lint / lint (push) Successful in 32s
Reviewed-on: #247
2026-11-17 17:19:23 +00:00
Defame1297andClaude Opus 5.5 76886fa5d5 docs(readme): list the shared binary update as internal role _binary_update
Build / build (pull_request) Successful in 13s
Lint / lint (pull_request) Successful in 34s
Molecule / molecule (pull_request) Successful in 1s
The Roadmap now names the wave 2 helper `_binary_update`: an internal
role called only by Collection roles, outside the semver promise, that
ships with the traefik extraction (ADR 0004 amendment, review in the
environment repository's #365).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-17 17:06:38 +00:00
kamino-renovate Bot 51bed6c9a8 Merge pull request 'chore(deps): update git.rkdr.net/mortis/molecule-ubuntu2604 docker tag to v0.1.5' (#241) from renovate/git.rkdr.net-mortis-molecule-ubuntu2604-0.x into main
Build / build (push) Successful in 12s
Lint / lint (push) Successful in 32s
Molecule / molecule (push) Successful in 9m44s
2026-11-16 22:27:21 +00:00
Defame1297 6bda5f252f Merge branch 'main' into renovate/git.rkdr.net-mortis-molecule-ubuntu2604-0.x
Build / build (pull_request) Successful in 12s
Molecule / molecule (pull_request) Successful in 9m49s
Lint / lint (pull_request) Successful in 32s
2026-11-16 22:06:05 +00:00
kamino-renovate Bot 49c78cd036 Merge pull request 'chore(deps): update git.rkdr.net/mortis/molecule-ubuntu2404 docker tag to v0.1.8' (#240) from renovate/git.rkdr.net-mortis-molecule-ubuntu2404-0.x into main
Build / build (push) Successful in 12s
Lint / lint (push) Successful in 32s
Molecule / molecule (push) Successful in 9m51s
2026-11-16 22:05:48 +00:00
renovate-bot ad8b193035 chore(deps): update git.rkdr.net/mortis/molecule-ubuntu2604 docker tag to v0.1.5
renovate/stability-days Updates have met minimum release age requirement
Build / build (pull_request) Successful in 12s
Molecule / molecule (pull_request) Canceled after 0s
Lint / lint (pull_request) Canceled after 13s
2026-11-16 21:54:34 +00:00
renovate-bot f1bac53250 chore(deps): update git.rkdr.net/mortis/molecule-ubuntu2404 docker tag to v0.1.8
renovate/stability-days Updates have met minimum release age requirement
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 32s
Molecule / molecule (pull_request) Successful in 9m49s
2026-11-16 21:54:33 +00:00
kamino-renovate Bot 8d735c6da1 Merge pull request 'chore(deps): update git.rkdr.net/mortis/ci docker tag to v0.2.28' (#238) from renovate/git.rkdr.net-mortis-ci-0.x into main
Build / build (push) Successful in 12s
Lint / lint (push) Successful in 32s
2026-11-16 21:48:59 +00:00
renovate-bot 82a28cec22 chore(deps): update git.rkdr.net/mortis/ci docker tag to v0.2.28
renovate/stability-days Updates have met minimum release age requirement
Build / build (pull_request) Successful in 27s
Lint / lint (pull_request) Successful in 33s
Molecule / molecule (pull_request) Successful in 1s
2026-11-16 21:47:45 +00:00
Defame1297 2debbfef04 Merge pull request 'chore(deps): update ubuntu:26.04 docker digest to d66b366' (#237) from renovate/job-container-ubuntu-26.04 into main
Build / build (push) Successful in 12s
Images / image (Dockerfile, ubuntu:24.04@sha256:73b999393d07f2bf65a40373778a44dc9a6d54ad7718d29247d8ff9413c4d6a8, molecule-ubuntu2404, images/molecule-ubuntu2404, 0.1.8) (push) Successful in 10s
Lint / lint (push) Successful in 32s
Images / image (Dockerfile, ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db, molecule-ubuntu2604, images/molecule-ubuntu2604, 0.1.5) (push) Successful in 10s
Images / image (images/ci/Dockerfile, ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db, ci, , 0.2.28) (push) Successful in 9s
Reviewed-on: #237
2026-11-16 21:46:36 +00:00
Defame1297 8f417d8d60 Merge branch 'main' into renovate/job-container-ubuntu-26.04
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 33s
Molecule / molecule (pull_request) Successful in 2s
2026-11-16 21:43:38 +00:00
kamino-renovate Bot 328f119020 Merge pull request 'chore(deps): update ubuntu:26.04 docker digest to d66b366' (#236) from renovate/ubuntu-26.04 into main
Build / build (push) Successful in 13s
Lint / lint (push) Successful in 34s
Images / image (Dockerfile, ubuntu:24.04@sha256:73b999393d07f2bf65a40373778a44dc9a6d54ad7718d29247d8ff9413c4d6a8, molecule-ubuntu2404, images/molecule-ubuntu2404, 0.1.8) (push) Successful in 9s
Images / image (Dockerfile, ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96, molecule-ubuntu2604, images/molecule-ubuntu2604, 0.1.5) (push) Successful in 28s
Images / image (images/ci/Dockerfile, ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96, ci, , 0.2.28) (push) Successful in 3m50s
2026-11-16 21:40:08 +00:00
Defame1297 061231c21c Merge branch 'main' into renovate/ubuntu-26.04
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 34s
Molecule / molecule (pull_request) Successful in 2s
2026-11-16 21:38:25 +00:00
Defame1297 9fdc70828e Merge pull request 'chore(deps): update ubuntu:24.04 docker digest to 73b9993' (#235) from renovate/job-container-ubuntu-24.04 into main
Build / build (push) Successful in 13s
Lint / lint (push) Successful in 33s
Images / image (Dockerfile, ubuntu:24.04@sha256:73b999393d07f2bf65a40373778a44dc9a6d54ad7718d29247d8ff9413c4d6a8, molecule-ubuntu2404, images/molecule-ubuntu2404, 0.1.8) (push) Successful in 11s
Images / image (Dockerfile, ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96, molecule-ubuntu2604, images/molecule-ubuntu2604, 0.1.4) (push) Successful in 10s
Images / image (images/ci/Dockerfile, ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96, ci, , 0.2.27) (push) Successful in 9s
Reviewed-on: #235
2026-11-16 21:38:11 +00:00
Defame1297 23608671ef Merge branch 'main' into renovate/job-container-ubuntu-24.04
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 33s
Molecule / molecule (pull_request) Successful in 2s
2026-11-16 21:35:27 +00:00
kamino-renovate Bot 191f332504 Merge pull request 'chore(deps): update ubuntu:24.04 docker digest to 73b9993' (#234) from renovate/ubuntu-24.04 into main
Build / build (push) Successful in 12s
Images / image (Dockerfile, ubuntu:24.04@sha256:2198e4c65076e9cb0b3d695219df667c0e3b0072da64ca3c2648aca17dcecaf5, molecule-ubuntu2404, images/molecule-ubuntu2404, 0.1.8) (push) Successful in 26s
Lint / lint (push) Successful in 33s
Images / image (Dockerfile, ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96, molecule-ubuntu2604, images/molecule-ubuntu2604, 0.1.4) (push) Successful in 14s
Images / image (images/ci/Dockerfile, ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96, ci, , 0.2.27) (push) Successful in 8s
2026-11-16 21:33:32 +00:00
renovate-bot 79aac32b3d chore(deps): update ubuntu:26.04 docker digest to d66b366
renovate/stability-days Updates have met minimum release age requirement
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 34s
Molecule / molecule (pull_request) Successful in 2s
2026-11-16 21:31:57 +00:00
renovate-bot ae822e72c7 chore(deps): update ubuntu:26.04 docker digest to d66b366
renovate/stability-days Updates have met minimum release age requirement
Build / build (pull_request) Successful in 13s
Lint / lint (pull_request) Successful in 34s
Molecule / molecule (pull_request) Successful in 1s
2026-11-16 21:31:53 +00:00
renovate-bot 1d7be7f6dd chore(deps): update ubuntu:24.04 docker digest to 73b9993
renovate/stability-days Updates have met minimum release age requirement
Build / build (pull_request) Successful in 14s
Lint / lint (pull_request) Successful in 33s
Molecule / molecule (pull_request) Successful in 2s
2026-11-16 21:31:51 +00:00
renovate-bot d9e43d1955 chore(deps): update ubuntu:24.04 docker digest to 73b9993
renovate/stability-days Updates have met minimum release age requirement
Build / build (pull_request) Successful in 13s
Lint / lint (pull_request) Successful in 34s
Molecule / molecule (pull_request) Successful in 2s
2026-11-16 21:31:48 +00:00
Defame1297 6a29576036 Merge pull request 'docs: drop environment names left in fail2ban and systemd_hardening' (#233) from docs/scrub-wave1-leftovers into main
Build / build (push) Successful in 13s
Lint / lint (push) Successful in 33s
Molecule / molecule (push) Successful in 10m2s
Reviewed-on: #233
2026-11-16 20:14:52 +00:00
Defame1297andClaude Opus 5.5 e2d89b9617 docs: drop environment names left in fail2ban and systemd_hardening
Build / build (pull_request) Successful in 13s
Lint / lint (pull_request) Successful in 34s
Molecule / molecule (pull_request) Successful in 1m44s
The fail2ban README example played against a consumer's real inventory
group; it now uses a generic group name. A systemd_hardening task comment
named a consumer playbook; it now describes the clash with any inventory
variable called `services` in general terms. No task or default changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-16 20:07:30 +00:00
16 changed files with 301 additions and 48 deletions

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ jobs:
timeout-minutes: 30
# The ci image (images/ci, built by image.yml): tag for the release, digest enforced.
container:
image: git.rkdr.net/mortis/ci:0.2.27@sha256:192242ca2159a4e5e404ef1cb520ca8fe2e5b473e68d44467eaee0a538ef3738
image: git.rkdr.net/mortis/ci:0.2.28@sha256:5236f475d9aa5446cecee4bb23becd411df3cb12963650d2f5821ef2b9d73b7c
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
steps:
+6 -6
View File
@@ -78,20 +78,20 @@ jobs:
matrix:
include:
- name: molecule-ubuntu2404
version: 0.1.7
version: 0.1.8
subpath: images/molecule-ubuntu2404
dockerfile: Dockerfile
job_image: ubuntu:24.04@sha256:2198e4c65076e9cb0b3d695219df667c0e3b0072da64ca3c2648aca17dcecaf5
job_image: ubuntu:24.04@sha256:73b999393d07f2bf65a40373778a44dc9a6d54ad7718d29247d8ff9413c4d6a8
- name: molecule-ubuntu2604
version: 0.1.4
version: 0.1.5
subpath: images/molecule-ubuntu2604
dockerfile: Dockerfile
job_image: ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
- name: ci
version: 0.2.27
version: 0.2.29
subpath: ""
dockerfile: images/ci/Dockerfile
job_image: ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
container:
image: ${{ matrix.job_image }}
# Keeps a runaway build from taking the whole 3 GB runner LXC down with it.
+1 -1
View File
@@ -35,7 +35,7 @@ jobs:
# The tag says which release, the digest is what is enforced (bump both together
# when image.yml publishes a new version).
container:
image: git.rkdr.net/mortis/ci:0.2.27@sha256:192242ca2159a4e5e404ef1cb520ca8fe2e5b473e68d44467eaee0a538ef3738
image: git.rkdr.net/mortis/ci:0.2.28@sha256:5236f475d9aa5446cecee4bb23becd411df3cb12963650d2f5821ef2b9d73b7c
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PRE_COMMIT_HOME: /opt/pre-commit
+2 -2
View File
@@ -76,11 +76,11 @@ jobs:
# Used by the scenarios as `image: ${MOLECULE_IMAGE}`; set it the same way to run
# one locally.
MOLECULE_IMAGE: >-
git.rkdr.net/mortis/molecule-ubuntu2404:0.1.7@sha256:683205d9b1d6892ede70e6478a031cee55c11a545f127577d7fcbb3f4b3adfaf
git.rkdr.net/mortis/molecule-ubuntu2404:0.1.8@sha256:e1ea7c6f953626c39d9f578d60a1ef668f09ed4e5d537d5c7601668b5c5e0eb3
# The same for Ubuntu 26.04, the release the hosts are moving to; used by
# `image: ${MOLECULE_IMAGE_2604}` in extensions/molecule/image-smoke-2604.
MOLECULE_IMAGE_2604: >-
git.rkdr.net/mortis/molecule-ubuntu2604:0.1.4@sha256:1b37c98656f68c24047fe8ad24e2f829ef146ad9aca5359d2a0acb9265db69af
git.rkdr.net/mortis/molecule-ubuntu2604:0.1.5@sha256:4ba40ee3603a33778254f22bc0f9360b9f7dd0ed5c03c5b2f935186c7b84dd6f
steps:
# The molecule venv is provisioned by the gitea_runner role (install_services); fail with
# a clear message when this runs before it has.
+1 -1
View File
@@ -29,7 +29,7 @@ repos:
# Python and shell scripts under scripts/ and tests/scripts/ (#112). ruff.toml holds the
# configuration. No --fix: a finding fails the hook instead of rewriting files in CI.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: ef6cf06c079dd6b299dfc720b0f14400c9d168e1 # frozen: v0.17.5
rev: 9026c9127e153371d7a78dfcb0c45ae2046a3d10 # frozen: v0.17.6
hooks:
- id: ruff-check
stages: ['pre-commit']
+2 -1
View File
@@ -73,7 +73,8 @@ Single-context: `GLOSSARY.md` and `docs/adr/` at the root, both created lazily.
- Molecule runs on every same-repo pull request, Renovate's included (a new image is tested by its own pin
pull request), with no workflow path filter, so that it can be a required check. Fork pull requests are skipped.
What a pull request runs is chosen by `scripts/select_molecule_scenarios.py`, run from the base branch's copy
(a pull request cannot edit its own rules): only the scenarios of the roles it changes, none for a diff of
(a pull request cannot edit its own rules): only the scenarios of the roles it changes and of the roles
that use them (any file naming `mortis.kamino.<role>`, transitively; a test fails a bare or templated role name in an include, import, play `roles:` entry or meta dependency), none for a diff of
only its IGNORED paths, a failure for a changed role with no scenario, and every scenario for any other file,
for every push to `main`, for manual dispatch and for the nightly run (04:43 UTC, after Renovate's). A new file outside `roles/<role>/` runs everything until it
is added to IGNORED, which is right only when no scenario reads it. A new commit cancels the pull request's
+5 -3
View File
@@ -20,14 +20,16 @@ _Avoid_: Gate, guard, guardrail, enforcement
### People
Each position is held per repository: a trusted contributor of another repository in the organisation can be a friend or an outsider here.
**Trusted contributor**:
A person the maintainer has given write access, and with it the secrets that write access exposes.
A person the maintainer has given write access to this repository, and with it the secrets that write access exposes.
_Avoid_: Collaborator, member
**Friend**:
A person the maintainer trusts not to act in bad faith but has not given write access; contributes from a fork, and each push runs only after the maintainer or a trusted contributor approves it.
A person the maintainer trusts not to act in bad faith but has not given write access to this repository; contributes from a fork, and each push runs only after the maintainer or a trusted contributor approves it.
_Avoid_: Fork contributor, guest
**Outsider**:
Anyone without a grant of trust from the maintainer, who contributes through issues.
Anyone without a grant of trust from the maintainer for this repository, who contributes through issues.
_Avoid_: External contributor, stranger
+3 -2
View File
@@ -40,8 +40,9 @@ the environment that uses it) are met.
Still to come:
- Wave 2: `binary_update` (shared binary-update logic), `pve_vm`, `pve_lxc`, `traefik`,
`gitea`, `gitea_runner`, `tailscale`, `cloudflared`, `pihole`.
- Wave 2: `_binary_update` (internal shared binary-update logic, called only by Collection
roles; ships with `traefik`), `pve_vm`, `pve_lxc`, `traefik`, `gitea`, `gitea_runner`,
`tailscale`, `cloudflared`, `pihole`.
- Wave 3: `rke2`, `proxmox_host`.
- Later, wave not yet assigned: `opnsense`, `proxmox_firewall`.
@@ -0,0 +1,4 @@
---
trivial:
- fail2ban - the README example play targets a generic group name.
- systemd_hardening - a task comment no longer names a consumer playbook.
+1 -1
View File
@@ -36,7 +36,7 @@
# build stage prints the sizes it will copy; the first push is the real test.
# Base image: ubuntu:26.04 index digest as of 2026-10-26, same as molecule-ubuntu2604.
FROM ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96 AS os
FROM ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db AS os
ENV DEBIAN_FRONTEND=noninteractive
+1 -1
View File
@@ -25,7 +25,7 @@
# fails without host keys, so they cannot be removed; image scanners will flag them.
# They are throwaway keys of a test target that is never exposed.
# ubuntu:24.04 index digest as of 2026-10-24 (24.04.5).
FROM ubuntu:24.04@sha256:2198e4c65076e9cb0b3d695219df667c0e3b0072da64ca3c2648aca17dcecaf5
FROM ubuntu:24.04@sha256:73b999393d07f2bf65a40373778a44dc9a6d54ad7718d29247d8ff9413c4d6a8
LABEL org.opencontainers.image.title="molecule-ubuntu2404" \
org.opencontainers.image.description="Disposable Ubuntu 24.04 test target for the molecule scenarios of the mortis.kamino Ansible Collection. systemd runs as PID 1 with D-Bus, sudo, python3 and the packages the roles manage (iptables, ufw, fail2ban, openssh-server) preinstalled, so a converge makes no network calls. Start it as a molecule platform (usage label); it carries throwaway SSH host keys and is a test target only, never to be exposed." \
+1 -1
View File
@@ -25,7 +25,7 @@
# fails without host keys, so they cannot be removed; image scanners will flag them.
# They are throwaway keys of a test target that is never exposed.
# ubuntu:26.04 index digest as of 2026-10-26.
FROM ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96
FROM ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
LABEL org.opencontainers.image.title="molecule-ubuntu2604" \
org.opencontainers.image.description="Disposable Ubuntu 26.04 test target for the molecule scenarios of the mortis.kamino Ansible Collection. systemd runs as PID 1 with D-Bus, sudo, python3 and the packages the roles manage (iptables, ufw, fail2ban, openssh-server) preinstalled, so a converge makes no network calls. Start it as a molecule platform (usage label); it carries throwaway SSH host keys and is a test target only, never to be exposed." \
+1 -1
View File
@@ -44,7 +44,7 @@ Main entry point: `fail2ban` (everything), `fail2ban_install`, `fail2ban_validat
## Example play
```yaml
- hosts: pve_lxcs
- hosts: containers
roles:
- role: mortis.kamino.fail2ban
vars:
+3 -3
View File
@@ -21,9 +21,9 @@
tags: always
# Not service_facts: it returns a fact named `services`, which (with
# inject_facts_as_vars) overrides the host_vars `services` list used by
# playbooks/install_services.yml. Only installed unit files are listed, so
# units that are merely referenced (LoadState not-found) are excluded.
# inject_facts_as_vars) overrides any inventory variable of that name, such as
# a list of services a playbook installs. Only installed unit files are listed,
# so units that are merely referenced (LoadState not-found) are excluded.
- name: List installed service unit files # noqa: command-instead-of-module
become: true
ansible.builtin.command: systemctl list-unit-files --type=service --no-legend --plain
+64 -7
View File
@@ -11,15 +11,21 @@ workflow runs `molecule test` in each.
Only a pull request is narrowed, and only when <base-ref> is given and EVENT_NAME is
`pull_request`. Then the diff of <base-ref>...HEAD decides:
* a file under roles/<role>/ selects that role's scenarios, and nothing else;
* a file under roles/<role>/ selects that role's scenarios, and those of every role that
uses it (below);
* a file on the IGNORED list (documentation, changelog, repository tooling that no
scenario reads) selects nothing;
* any other file selects every scenario.
The roles do not depend on one another, so a change inside one role cannot alter another
role's result. If one ever does (a role calling another, a shared plugin), the shared file
sits outside roles/<role>/ and so already selects everything; only an explicit role-to-role
dependency would need a rule here.
A role uses another when any file under its directory names it as `mortis.kamino.<other>`
(an include_role, a scenario's prepare play, a comment). The relation is transitive: when
`a` names `b` and `b` names `c`, a change to `c` selects all three. The roles call each other
by that full name only (a test checks includes, imports, play `roles:` entries and meta
dependencies for a bare or templated role name), so the text search finds every use. It reads the
tree under test, not the base: a pull request that drops a use also changes the using role,
which then selects itself, and a role the pull request deletes or renames still counts as used
by the roles that name it. A shared file outside roles/<role>/ (a plugin) already selects
everything.
Every other case runs everything: a push, a manual dispatch, a scheduled run, no <base-ref>, a git
failure.
@@ -42,6 +48,7 @@ control characters in paths escaped so a crafted file name cannot inject a log c
import fnmatch
import os
import re
import subprocess
import sys
@@ -123,6 +130,48 @@ def discover(root="."):
return found
ROLE_REFERENCE = re.compile(r"mortis\.kamino\.([A-Za-z0-9_]+)")
def users(root=".", gone=()):
"""Map each role to the roles whose files name it as mortis.kamino.<role>.
Self-references (a scenario converging its own role) are left out, and so are names that
are neither a role directory nor in `gone`: the changed roles, so that a role deleted or
renamed by the pull request still selects the roles that call it.
"""
base = os.path.join(root, "roles")
if not os.path.isdir(base):
return {}
roles = {r for r in os.listdir(base) if os.path.isdir(os.path.join(base, r))}
known = roles | set(gone)
used_by = {}
for role in roles:
for dirpath, _dirs, files in os.walk(os.path.join(base, role)):
for name in files:
try:
with open(os.path.join(dirpath, name), "rb") as f:
text = f.read().decode("utf-8", "ignore")
except OSError:
continue
for other in ROLE_REFERENCE.findall(text):
if other != role and other in known:
used_by.setdefault(other, set()).add(role)
return used_by
def with_users(roles, used_by):
"""`roles` plus every role that uses one of them, directly or through another."""
found = set(roles)
todo = list(roles)
while todo:
for user in used_by.get(todo.pop(), ()):
if user not in found:
found.add(user)
todo.append(user)
return found
def is_ignored(path):
return any(fnmatch.fnmatchcase(path, pattern) for pattern in IGNORED)
@@ -141,6 +190,8 @@ def select(all_scenarios, changed, root="."):
roles.add(parts[1])
continue
return list(all_scenarios), f"{printable(path)} can affect every scenario"
changed_roles = roles
roles = with_users(changed_roles, users(root, changed_roles))
chosen = [
s for s in all_scenarios if s.startswith("roles/") and s.split("/")[1] in roles
]
@@ -150,11 +201,17 @@ def select(all_scenarios, changed, root="."):
)
if bare:
raise ValueError(
"changed role without a molecule scenario: "
"role without a molecule scenario (changed, or a user of a changed role): "
+ ", ".join(printable(r) for r in bare)
)
if roles:
reason = "only roles changed: " + ", ".join(printable(r) for r in sorted(roles))
reason = "only roles changed: " + ", ".join(
printable(r) for r in sorted(changed_roles)
)
if roles - changed_roles:
reason += "; their users: " + ", ".join(
printable(r) for r in sorted(roles - changed_roles)
)
else:
reason = "no change that a scenario reads"
return chosen, reason
+205 -17
View File
@@ -6,6 +6,7 @@ import contextlib
import io
import os
import pathlib
import shutil
import subprocess
import sys
import tempfile
@@ -18,6 +19,75 @@ REPO = pathlib.Path(__file__).resolve().parents[2]
sys.path.insert(0, str(REPO / "scripts"))
import select_molecule_scenarios as sel
ROLE_KEYS = {
f"{prefix}{verb}"
for prefix in ("", "ansible.builtin.", "ansible.legacy.")
for verb in ("include_role", "import_role")
}
TASK_KEYS = {
f"{prefix}{verb}"
for prefix in ("", "ansible.builtin.", "ansible.legacy.")
for verb in ("include_tasks", "import_tasks")
}
def _arg(value, key):
"""`key` of a module argument given as a mapping, a k=v string or a bare string."""
if isinstance(value, dict):
return value.get(key)
if not isinstance(value, str):
return None
for word in value.split():
if word.startswith(f"{key}="):
return word[len(key) + 1 :]
return None if "=" in value else value
def _name_problem(name, how, roles):
if not isinstance(name, str):
return []
if "{{" in name:
return [f"{how} a templated role name {name!r}"]
if name in roles:
return [f"{how} {name} by its bare name"]
return []
def _play_roles_problems(play, roles):
problems = []
for entry in play.get("roles") if isinstance(play.get("roles"), list) else []:
name = (
entry.get("role", entry.get("name")) if isinstance(entry, dict) else entry
)
problems += _name_problem(name, "a play's roles: uses", roles)
return problems
def _key_problems(key, value, roles):
if key in ROLE_KEYS:
return _name_problem(_arg(value, "name"), f"{key} uses", roles)
if key in TASK_KEYS:
target = _arg(value, "file")
if isinstance(target, str) and ".." in target:
return [f"{key} reaches outside the role: {target!r}"]
return []
def role_use_problems(node, roles, in_list=False):
"""The ways `node` (parsed YAML) uses a role that users() could not see."""
problems = []
if isinstance(node, dict):
if in_list:
problems += _play_roles_problems(node, roles)
for key, value in node.items():
problems += _key_problems(key, value, roles)
problems += role_use_problems(value, roles)
elif isinstance(node, list):
for item in node:
problems += role_use_problems(item, roles, in_list=True)
return problems
ALL = [
"extensions/molecule/image-smoke",
"extensions/molecule/image-smoke-2604",
@@ -83,6 +153,104 @@ class SelectTest(unittest.TestCase):
self.assertEqual(chosen, ALL)
class UsersTest(unittest.TestCase):
SCENARIOS = (
"roles/base/molecule/default",
"roles/_helper/molecule/default",
"roles/service/molecule/default",
"roles/other/molecule/default",
)
def tree(self, root, files):
for rel, text in files.items():
f = pathlib.Path(root, rel)
f.parent.mkdir(parents=True, exist_ok=True)
f.write_text(text)
for s in self.SCENARIOS:
pathlib.Path(root, s).mkdir(parents=True, exist_ok=True)
pathlib.Path(root, s, "molecule.yml").write_text("---\n")
def chain(self, root):
# service uses _helper, _helper uses base; other uses nothing and names itself.
self.tree(
root,
{
"roles/service/tasks/main.yml": "name: mortis.kamino._helper\n",
"roles/_helper/tasks/main.yml": "name: mortis.kamino.base\n",
"roles/base/tasks/main.yml": "---\n",
"roles/other/molecule/default/converge.yml": "mortis.kamino.other\n",
},
)
def test_a_change_selects_its_users_transitively(self):
with tempfile.TemporaryDirectory() as root:
self.chain(root)
chosen, reason = sel.select(
self.SCENARIOS, ["roles/base/tasks/main.yml"], root
)
self.assertEqual(
sorted(chosen),
[
"roles/_helper/molecule/default",
"roles/base/molecule/default",
"roles/service/molecule/default",
],
)
self.assertIn("their users: _helper, service", reason)
def test_a_user_change_does_not_select_what_it_uses(self):
with tempfile.TemporaryDirectory() as root:
self.chain(root)
chosen, _reason = sel.select(
self.SCENARIOS, ["roles/service/tasks/main.yml"], root
)
self.assertEqual(chosen, ["roles/service/molecule/default"])
def test_self_and_unknown_names_are_not_uses(self):
with tempfile.TemporaryDirectory() as root:
self.chain(root)
pathlib.Path(root, "roles/other/tasks").mkdir(parents=True)
pathlib.Path(root, "roles/other/tasks/main.yml").write_text(
"mortis.kamino.nosuchrole\n"
)
self.assertEqual(
sel.users(root), {"_helper": {"service"}, "base": {"_helper"}}
)
chosen, _reason = sel.select(
self.SCENARIOS, ["roles/other/tasks/main.yml"], root
)
self.assertEqual(chosen, ["roles/other/molecule/default"])
def test_a_user_without_a_scenario_fails(self):
with tempfile.TemporaryDirectory() as root:
self.chain(root)
self.tree(root, {"roles/bare/tasks/main.yml": "mortis.kamino.base\n"})
with self.assertRaisesRegex(ValueError, "bare"):
sel.select(self.SCENARIOS, ["roles/base/tasks/main.yml"], root)
def test_a_deleted_role_still_selects_its_users(self):
with tempfile.TemporaryDirectory() as root:
self.chain(root)
shutil.rmtree(pathlib.Path(root, "roles/base"))
scenarios = [s for s in self.SCENARIOS if not s.startswith("roles/base/")]
chosen, _reason = sel.select(scenarios, ["roles/base/tasks/main.yml"], root)
self.assertEqual(
sorted(chosen),
["roles/_helper/molecule/default", "roles/service/molecule/default"],
)
def test_cycles_terminate(self):
with tempfile.TemporaryDirectory() as root:
self.chain(root)
pathlib.Path(root, "roles/base/tasks/main.yml").write_text(
"mortis.kamino.service\n"
)
chosen, _reason = sel.select(
self.SCENARIOS, ["roles/base/tasks/main.yml"], root
)
self.assertEqual(len(chosen), 3)
class MainTest(unittest.TestCase):
def setUp(self):
# main() runs git in the current directory: a hook's GIT_DIR must not redirect it.
@@ -193,7 +361,8 @@ class MainTest(unittest.TestCase):
code, out, err = self.run_main(["main"], {"EVENT_NAME": "pull_request"})
self.assertEqual((code, out), (1, []))
self.assertIn(
"::error::changed role without a molecule scenario: newrole", err
"::error::role without a molecule scenario (changed, or a user of a changed role): newrole",
err,
)
def test_deleted_role_is_not_an_error(self):
@@ -272,24 +441,20 @@ class MainTest(unittest.TestCase):
chosen, _reason = sel.select(scenarios, [path], str(REPO))
self.assertEqual(chosen, scenarios, path)
def test_no_role_refers_to_another_role(self):
# The selection assumes roles are independent: a role that includes another would need a
# dependency rule in select(). Fail here instead of silently skipping the other's scenario.
def test_roles_call_each_other_by_full_name_only(self):
# The selection finds a role's users by the text mortis.kamino.<role> (users()). A use
# by a bare or templated name, a meta dependency, or tasks reached by a relative path
# into another role would be one it cannot see, so its users' scenarios would be
# skipped. Fail here instead.
roles = sorted(p.name for p in (REPO / "roles").iterdir() if p.is_dir())
for role in roles:
others = [r for r in roles if r != role]
for path in (REPO / "roles" / role).rglob("*"):
if not path.is_file():
continue
text = path.read_text(errors="ignore")
for other in others:
self.assertNotIn(
f"mortis.kamino.{other}",
text,
f"{path.relative_to(REPO)} refers to {other}",
)
meta = REPO / "roles" / role / "meta" / "main.yml"
if meta.is_file():
for path in sorted((REPO / "roles" / role).rglob("*")):
if path.suffix in (".yml", ".yaml") and path.is_file():
for problem in role_use_problems(
yaml.safe_load(path.read_text()), roles
):
self.fail(f"{path.relative_to(REPO)}: {problem}")
for meta in (REPO / "roles" / role / "meta").glob("main.y*ml"):
data = yaml.safe_load(meta.read_text()) or {}
self.assertEqual(
data.get("dependencies") or [],
@@ -297,6 +462,29 @@ class MainTest(unittest.TestCase):
f"{role} declares role dependencies",
)
def test_role_use_problems_catches_the_hidden_forms(self):
roles = ["ufw", "traefik"]
for doc in (
[{"ansible.builtin.include_role": {"name": "ufw"}}],
[{"import_role": "name=ufw tasks_from=x"}],
[{"include_role": {"name": "{{ dep }}"}}],
[{"include_role": {"name": "mortis.kamino.{{ dep }}"}}],
[{"hosts": "all", "roles": ["ufw"]}],
[{"hosts": "all", "roles": [{"role": "ufw"}]}],
[{"hosts": "all", "roles": [{"name": "{{ r }}"}]}],
[{"ansible.builtin.include_tasks": "../../ufw/tasks/x.yml"}],
[{"import_tasks": {"file": "{{ role_path }}/../ufw/tasks/x.yml"}}],
):
self.assertTrue(role_use_problems(doc, roles), doc)
for doc in (
[{"include_role": {"name": "mortis.kamino.ufw"}}],
[{"hosts": "all", "roles": ["mortis.kamino.traefik"]}],
[{"include_role": {"name": "community.general.thing"}}],
[{"include_tasks": "download.yml"}],
{"roles": "not a play"},
):
self.assertEqual(role_use_problems(doc, roles), [], doc)
def test_literal_ignored_entries_exist(self):
for pattern in sel.IGNORED:
if "*" not in pattern: