Commit Graph
44 Commits
Author SHA1 Message Date
Defame1297 c19c7abb20 Merge branch 'main' into ci/molecule-parallel-scenarios
Build / build (pull_request) Successful in 23s
Lint / lint (pull_request) Successful in 1m16s
Molecule / molecule (pull_request) Successful in 11m47s
2026-11-23 06:51:55 +00:00
Defame1297 f77586dc60 ci(molecule): remove each scenario's containers in the workflow instead of molecule's destroy
molecule's trailing destroy runs the Docker driver's destroy playbook, whose
"Wait for instance(s) deletion to complete" task alone costs about 5.6 s per
scenario, about 84 s over the 15 scenarios of a full run. The whole destroy
phase measured about 103 s per full run (the median across full runs, among
them 4764, 4714, 4698 and 4578). The workflow already removes stale
containers before the run, so it can remove each scenario's containers itself
with `docker rm -f` as soon as the scenario ends, pass or fail, and skip the
playbook.

The names come from each scenario's molecule.yml (platforms[].name) via the
molecule venv's Python and PyYAML, so no list is kept in the workflow. A
failed removal fails the step. The test_sequence rule in the workflow guidance
now says both destroys are left out and that platform names are literal.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-22 22:33:52 +00:00
Defame1297 fdb3f8c1df test(molecule): move refusal plays from converge to verify
Build / build (pull_request) Successful in 25s
Lint / lint (pull_request) Successful in 1m16s
Molecule / molecule (pull_request) Successful in 9m29s
molecule's idempotence step reruns converge.yml, so plays that only prove a
role refuses bad input ran twice and added nothing the second time. The ufw,
sshd, gitea and traefik scenarios now keep only the plays that apply the role
in converge.yml; the refusal plays and gitea's child ansible-playbook guard
checks run once, first in verify.yml. Every existing assertion runs after
them, so verify still proves a refused run left the host unchanged.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-22 22:15:37 +00:00
Dragonish 6c2d124b3f fix(systemd_hardening): look up the listed units instead of listing every unit file
Build / build (pull_request) Successful in 20s
Molecule / molecule (pull_request) Canceled after 0s
Lint / lint (pull_request) Canceled after 38s
The role listed every service unit file to answer one question: is each
unit in its disable and mask lists installed? The listing keeps PID 1 busy
for as long as the host has unit files. Ask about the listed units only,
with one `systemctl show --property=LoadState`; a unit with no unit file
reports `not-found` and is skipped as before.

An instance name such as [email protected] is now matched when its template
exists. A template name such as [email protected] makes the lookup fail, where
the listing matched it.

Closes #283

Assisted-by: Claude Code
2026-11-22 19:41:23 +00:00
Defame1297andClaude Opus 5.5 5de1e61bfd test(gitea_runner): keep the newline after the fail-case touch
Build / build (pull_request) Successful in 14s
Lint / lint (pull_request) Successful in 48s
Molecule / molecule (pull_request) Canceled after 31s
trim_blocks removed the newline after the endif, so the touch and the
gate call ran as one command and the ps-fails case never reached the
gate. An inline expression keeps the line break.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-22 16:42:30 +00:00
Defame1297andClaude Opus 5.5 e296eea609 feat(gitea_runner): add the gitea_runner role
Build / build (pull_request) Successful in 15s
Lint / lint (pull_request) Successful in 50s
Molecule / molecule (pull_request) Failing after 1m10s
Copied from the maintainer's local role and reworked for the Collection:
the binary swap and rollback of an update go through the internal
_binary_update role, input checks move to tasks/validate.yml, the
removal ends the role, commands take argv, and the molecule tooling
needs an explicit collections requirements file. Adds a molecule
scenario with stub Docker, runner and release files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-22 16:26:49 +00:00
Defame1297andClaude Opus 5.5 0837cc387f ci(gitea): warn before the Gitea release key stops verifying releases
Build / build (pull_request) Successful in 15s
Gitea release key / check (pull_request) Successful in 9s
Lint / lint (pull_request) Successful in 51s
Molecule / molecule (pull_request) Canceled after 36s
The gitea role accepts a release only when it carries a valid signature by
gitea_gpg_key_id or one of its subkeys, so an expired, revoked or replaced
Gitea release key makes every install and update fail closed, without
warning, on the day it happens.

scripts/check_gitea_release_key.py reads the pins from the role defaults,
fetches the release key into a throwaway keyring and only the .asc of the
pinned release (never the binary), and fails when the primary key or a
signing subkey expires within 60 days, is revoked or expired, or when a
signature in the .asc is not by a valid signing key of the pinned key. Its
docstring says what to do on a failure.

The Gitea release key workflow runs it weekly, by hand, and on pull requests
that change the role defaults or the check, so a gitea_version bump is
checked against the new release's signature. It runs in the ci image at the
pin of lint.yml; that image has gpgv but not gpg, so the job installs gpg and
gpg-agent from the Ubuntu archive per run instead of making the check an
image input. The tests that make keys skip without gpg, so the Lint job's
unittest run (no gpg) still covers the parsing and rendering tests.

The workflow pins the ci image, so it joins the pin consumers of
check_image_versions.py and check_bot_pr_diff.py: Renovate's pin follow-up
edits every workflow, and the bot-diff gate would otherwise refuse that pull
request. The new workflow and script are on the molecule selector's IGNORED
list, since no scenario reads them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-22 07:29:31 +00:00
Defame1297 fef9e16765 Merge branch 'main' into feat/gitea-role
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 44s
Molecule / molecule (pull_request) Successful in 1m20s
2026-11-21 22:41:11 +00:00
Defame1297andClaude Opus 5.5 f060461152 feat(gitea): add the gitea role
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Failing after 43s
Molecule / molecule (pull_request) Successful in 1m20s
Moves the gitea role from the environment repository, the second wave 2 role and the
second caller of the internal _binary_update role.

Against the source:
- The update path stages the downloaded, signature-verified binary in a directory next to
  the live one and hands the stop, backup, swap, restart, version check and rollback to
  mortis.kamino._binary_update (include_role with apply tags, so --tags update reaches
  it). A download or signature failure still leaves the running service untouched and
  says so; a failure in the swap keeps the rollback message of _binary_update. Its default
  version regex is the one the source used.
- The same two small behaviour changes as for traefik come with _binary_update: the backup
  is taken whenever a live binary exists, and a failure before the stop no longer
  restarts the running service.
- The update no longer removes a PID file between the stop and the start, and
  gitea_pid_file is gone: the unit runs `gitea web` without --pid and has no PIDFile=,
  so Gitea writes no PID file and systemd reads none.
- The database-migration warning of the source's rollback message (the previous binary
  may refuse a migrated schema) moves to the gitea_update docs in the README and the
  argument_specs, since _binary_update owns the failure message.
- The legacy name guard (pre-rename variables of the environment) is dropped, as in the
  wave 1 roles, and the argument_specs and README no longer mention it. The jwt secret,
  mailer and e-mail confirmation asserts stay.
- Environment references are gone from comments, app.ini.j2, the README and the
  argument_specs: issue numbers, decision records, host names, inventory paths,
  playbooks, the network and proxy layout and other roles' copies of the paths. The
  Renovate comment on gitea_version is dropped; the README and argument_specs recommend
  pinning the version in inventory. The mint messages no longer name a playbook.
- On a fresh host the token assert and the SSH-key upload ran before the unit was
  written and Gitea started, so a first install could never complete. Both now run after
  the service check, and the upload first waits (up to 60 s, not under --check) for the
  local listener; the listener address is resolved once for both.
- REVERSE_PROXY_LIMIT, hard-coded to 2, is now gitea_reverse_proxy_limit with default 1:
  a limit above the real number of proxies lets a client forge the address Gitea logs and
  Fail2Ban bans. A setup with two proxies sets it to 2.
- The gitea commands with user-supplied values (migrate, admin user list and create, and
  the token mint) take argv instead of a command string; still run through sudo -u.
- gitea_version is asserted at role start to be a plain X.Y.Z, with no leading v.
- meta namespace mortis; the scenario follows the Kamino conventions (header,
  test_sequence, no provisioner env) and calls the role by FQCN, also in the child
  ansible-playbook of the mint CI-guard cases. Coverage is unchanged.

No other default changed; DISABLE_REGISTRATION stays hard-coded to true.

Changelog fragment, README Roadmap and the CLAUDE.md role list updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-21 21:53:20 +00:00
Defame1297andClaude Opus 5.5 8f08badfd4 docs(agents): rewrap the layout rule
Build / build (pull_request) Successful in 13s
Lint / lint (pull_request) Successful in 43s
Molecule / molecule (pull_request) Successful in 15m53s
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
2026-11-21 21:37:33 +00:00
Defame1297andClaude Opus 5.5 f01f6b9374 docs(agents): keep the no-alias rule to inputs and reconcile platform aims
Review round 2: the no-alias ban was decided for inputs only; the
fragment check requires a fragment and checks the section only for a
dropped platform; schema[role-arg-spec] holds entry-level misuse; say
why internal roles are listed in .ansible-lint-ignore; scope the
all-three-releases aim to roles that target both kinds of host.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
2026-11-21 21:35:19 +00:00
Defame1297andClaude Opus 5.5 11c1483af3 docs(agents): word pending controls as pending in roles/AGENTS.md
Review: name the check each pending control will be, not only its issue;
state complexity and the role-name exemption as future controls; name
schema[role-arg-spec] for the validation misuse; merge the duplicated
input rule into the role interface; add entry-point validation and the
negative-test ordering; drop the claim that contributor docs point here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
2026-11-21 21:32:25 +00:00
Defame1297andClaude Opus 5.5 e524eef4e8 docs(agents): write roles/AGENTS.md with the role rules
State every role rule in force with its reason and how it is held. Rules
whose control has not landed say "review until #N lands".

Keep the file out of the Collection tarball (build_ignore) until the
tarball check refuses AGENTS.md at any depth, and put it on the Molecule
selector's IGNORED list: no scenario reads it.

Closes #181

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
2026-11-21 21:20:10 +00:00
Defame1297andClaude Opus 5.5 589b71a312 feat(traefik): add the traefik role
Build / build (pull_request) Successful in 15s
Lint / lint (pull_request) Successful in 1m32s
Molecule / molecule (pull_request) Successful in 3m38s
Moves the traefik role from the environment repository, the first wave 2 role and the
first caller of the internal _binary_update role.

Against the source:
- The update path stages the downloaded, checksum-verified binary in a directory next to
  the live one and hands the stop, backup, swap, restart, version check and rollback to
  mortis.kamino._binary_update (include_role with apply tags, so --tags update reaches
  it). A download or checksum failure still leaves the running service untouched and
  says so; a failure in the swap keeps the rollback message of _binary_update.
- Two small behaviour changes come with _binary_update: the backup is taken whenever a
  live binary exists (the source skipped it when the binary reported no version), and a
  failure before the stop no longer restarts the running service.
- The legacy name guards (pre-rename variables of the environment) are dropped, as in
  the wave 1 roles, and the argument_specs and README no longer mention them.
- Environment references are gone from comments, the README and the argument_specs:
  issue numbers, host names, inventory paths, playbooks and the role's own history. The
  Renovate comment on traefik_version is dropped, since this repository has no manager
  for it; the README and argument_specs recommend pinning the version in inventory.
- meta namespace mortis; the scenario follows the Kamino conventions (header,
  test_sequence, no provisioner env) and calls the role by FQCN.
- The scenario's verify gains a real version bump: down to another release (v3.7.18)
  and back to the role default with traefik_update, asserting the version, an active
  unit and no staging directory, backup or download left behind.

Changelog fragment, README Roadmap and the CLAUDE.md role list updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-20 19:20:37 +00:00
Defame1297andClaude Opus 5.5 f4965db6f3 feat(_binary_update): add the internal binary update role
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 1m17s
Molecule / molecule (pull_request) Successful in 11m34s
Swaps a staged, verified binary into place for a systemd service: refuse when nothing
executable is staged, then reload, stop and wait, back up the live binary, rename the
staged file over it, start and wait for active, and compare the reported version. A
failure after the stop restores this run's backup, starts the service again and fails
with a message that says whether the restore and the restart worked. Under --check the
waits and the version check are skipped, so a preview against a stopped service does
not fall into the rollback. The staged file is removed in every case.

The role is internal (ADR 0004 in the environment repository): called only by roles of
this Collection by FQCN, outside the public API, marked by the underscore, [INTERNAL]
in its meta and argument_specs, and a first task that refuses a call without a parent
role. traefik is its first caller and arrives in the same release.

Two molecule scenarios use stub binaries under a stub unit, without network: default
(successful bump and idempotence, a binary that cannot start, a binary that reports the
wrong version, nothing staged, a direct call, a first install) and check_mode (the bump
under molecule check against a stopped service changes nothing).

Lint: role-name is skipped (its regex rejects the leading underscore, as for
prometheus.prometheus roles/_common), meta has no role_name (schema[meta] uses the same
regex and cannot be skipped), and .ansible-lint-ignore lists the role's own files for
var-naming[no-role-prefix], which strips the underscore from the variable but not from
the role name and so cannot pass. The ignore file is kept out of the Collection build
and is on the scenario picker's IGNORED list. The README Roadmap no longer lists the role.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-20 19:00:19 +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
Defame1297andClaude Opus 5.5 ce537fc6b4 fix(user_management): hand back to the created user and refuse a mismatched fallback
Build / build (pull_request) Successful in 13s
Lint / lint (pull_request) Successful in 34s
Molecule / molecule (pull_request) Successful in 10m5s
The handback switched the connection to ansible_user, while the role creates
user_management_ansible_user.name. When the two differed, the root fallback
created a user nobody connects as, and the handback then failed after the
changes made as root, or later plays connected as the wrong user.

The fallback now asserts, before switching to root, that the primary user's
name equals ansible_user (set as a variable), and the handback switches to
the user the role created. No change where the names are equal (the default).

Also name user_management as a user of ansible.posix in the galaxy.yml comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-16 17:27:39 +00:00
Defame1297andClaude Opus 5.5 da87a7e141 docs(user_management): state gather_facts, key exclusivity and known limits
From review of the extraction. Documentation only; behaviour is unchanged.
- The play needs gather_facts: false, or a fresh guest is unreachable before
  the root fallback runs (README requirement and example, argument spec).
- user_management_authoritative skips a user whose merged key list is empty,
  so emptying the list keeps that user's existing keys.
- user_management_become_password_hashed is required unless
  user_management_ansible_user is overridden.
- Known limits: molecule does not exercise the fallback or the handback, the
  handback reconnects as ansible_user, a partial tag run on a fresh host
  fails at the handback, and the primary user can be set absent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-16 17:21:38 +00:00
Defame1297andClaude Opus 5.5 a1645040ae docs(user_management): say how the root password lock works in the defaults comment
The comment said usermod -L, but the role replaces the shadow field with "!" and
drops the old hash, which usermod -L would keep.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-16 17:15:21 +00:00
Defame1297andClaude Opus 5.5 f290b9f151 docs(user_management): name the sshd role without its FQCN
The README and the comments of tasks/bootstrap.yml, tasks/handback.yml
and tasks/lock_root.yml named mortis.kamino.sshd, which the
role-independence test refuses in a role's docs. They now name the sshd
role (of this Collection), as the ufw role does for system_baseline. The
role's own FQCN in its README and scenario stays, as in sshd and ufw.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-16 17:14:02 +00:00
Defame1297andClaude Opus 5.5 2713753039 feat(user_management): add the user_management role
Copied from the environment repository's local role. The files are
identical except: galaxy namespace mortis; comments and the README
scrubbed of environment references (issue numbers, playbooks, inventory
groups and group_vars paths, the provisioning roles by name, the history
of the variable rename), with the technical explanation kept; the README
asks for the role by its FQCN, names the run order generically (after the
step that creates the guest, before mortis.kamino.sshd) and its example
play uses mortis.kamino.user_management; the molecule scenario calls the
role by its FQCN, follows the Kamino scenario conventions (kamino-molecule
header, scenario.test_sequence) and no longer sets ANSIBLE_COLLECTIONS_PATH
or ANSIBLE_ROLES_PATH. No variable, default, argument_specs entry or task
logic changed: the key-only root fallback, the handback and
user_management_lock_root_password (default false) are as in the source,
and prepare/verify are unchanged. The role uses ansible.posix
(authorized_key), already a galaxy.yml dependency, so galaxy.yml is
unchanged.

The README Roadmap no longer lists wave 1; CLAUDE.md names the role for
the next release.

Not verified locally: the molecule scenario (it runs on the
kamino-molecule runner in CI) and ansible-test sanity (runs on push).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-16 17:12:05 +00:00
Defame1297 14a9a72ea2 Merge branch 'main' into feat/ufw-rule-delete
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 30s
Molecule / molecule (pull_request) Successful in 2m38s
2026-11-15 22:31:04 +00:00
Defame1297andClaude Opus 5.5 9d7625f529 docs(sshd): apply review notes to the argument spec and README
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 31s
Molecule / molecule (pull_request) Successful in 35s
The main entry's description now lists all four refusals (the pve
rsa-sha2-512 guard and the ssh-rsa guard were missing, already in the
source). The README no longer names user_management as if it were a role
of this Collection, and says the scenario runs in the Collection's CI
rather than only on pull requests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-15 22:25:50 +00:00
Defame1297andClaude Opus 5.5 43bb2ce8dc fix(ufw): normalise the conflict check and send deletes without a comment
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 28s
Molecule / molecule (pull_request) Canceled after 1m25s
Review findings on the delete support:

- The both-added-and-deleted check compared the written fields, so
  direction: in or from: any on the added rule hid a conflict that ufw
  sees (it stores no direction as in and no address as any); the delete
  then removed the SSH rule the lock-out guard had counted. Fields are now
  normalised as ufw stores them (incoming/outgoing as in/out too). A
  missing proto stays distinct from tcp, as in ufw.
- A delete sent with a comment that differs from the stored one matches
  nothing in ufw and exits 0, so the rule stayed silently. Deletes are now
  sent without their comment; ufw then matches the rule whatever its
  comment. The scenario's delete entry carries a different comment to
  cover it, and the conflict refusal uses the explicit defaults.
- README: a delete without an address removes the IPv4 and IPv6 rules,
  an IPv4 from allows IPv4 only.
- verify searches 9091/tcp, not a bare 9091 that an owner tag could hold.

Verified locally in check mode against localhost: both bypass lists and
an incoming/outgoing spelling are refused; the planned replacement list
and a no-proto add with a tcp delete pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-15 22:24:55 +00:00
Defame1297andClaude Opus 5.5 10a620a2d9 feat(ufw): let ufw_rules entries delete a rule
An entry with delete: true (a boolean) removes the rule it describes,
passed to community.general.ufw's delete option. It lets a consumer
replace a base rule, such as an open SSH allow by narrower ones, which
the role could only add before.

- rules.yml applies the delete entries after every other rule, whatever
  their place in the list, so the replacement exists before the old rule
  goes.
- validate.yml: the schema check requires a boolean; a new check refuses
  a rule the list both adds and deletes (compared without the comment,
  port as a string), because the delete would win while the lock-out
  guard counted the add; the lock-out guard no longer counts a delete
  entry.
- service_rules keeps its own key list and does not accept delete.

Molecule: prepare stores a commented 9091 rule that the base list deletes
with an uncommented entry listed first; verify checks it is gone and the
untagged count is unchanged; the idempotence pass covers deleting a rule
that is gone. Two new refusals: an SSH rule that is only deleted (lock-out
guard) and a rule both added and deleted.

Verified locally: validate.yml against localhost in check mode (the
planned replacement list passes; the conflict, the delete-only SSH list
and a non-boolean delete are refused) and the apply order. Not verified
locally: the molecule scenario (CI only), including whether ufw matches
the commented rule from an uncommented delete.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-15 22:12:16 +00:00
Defame1297andClaude Opus 5.5 915f588533 feat(sshd): add the sshd role
Copied from the environment repository's local role. The files are
identical except: galaxy namespace mortis; comments, the README and the
guard failure messages scrubbed of environment references (issue numbers,
playbooks, inventory groups, the caller role's fallback, history of the
old vars/ files and of the variable renames), with the technical
explanation kept; the README's run order now asks for the ansible_user key
to be installed first instead of naming the environment's playbooks; the
molecule scenario calls the role by its FQCN (mortis.kamino.sshd), follows
the Kamino scenario conventions (kamino-molecule header,
scenario.test_sequence) and no longer sets ANSIBLE_COLLECTIONS_PATH or
ANSIBLE_ROLES_PATH. No variable, default, argument_specs type or task
logic changed; the test coverage is the same. The role uses
ansible.builtin only, so galaxy.yml's dependencies are unchanged.

The README Roadmap no longer lists sshd.

Not verified locally: the molecule scenario (it runs on the
kamino-molecule runner in CI) and ansible-test sanity (runs on push).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-15 22:08:10 +00:00
Dragonish 9dcb933bf9 test(fail2ban): match the validation message in the ignoreip rejection cases
Build / build (pull_request) Successful in 13s
Lint / lint (pull_request) Successful in 28s
Molecule / molecule (pull_request) Successful in 1m2s
The three rejection cases only printed "Rejected as expected", so they would
also pass when the role failed for another reason. Assert that the failure
carries the validation message of fail2ban_ignoreip.

Assisted-by: Claude Code
2026-11-15 13:35:14 +00:00
Dragonish 2b994363d7 fix(fail2ban): refuse a scalar or non-string fail2ban_ignoreip
argument_specs accepts a plain string for a list option and leaves it a string,
and accepts a list holding a number or null. The pattern check then iterated a
string per character and rendered "1 . 2 . 3 . 4", or died with a TypeError on
null. Check the type first (assert stops at the first false item).

Also refuse ";" and "%" in an entry: Fail2Ban's config parser treats ";" after
whitespace as an inline comment, which drops the rest of the ignoreip line
without an error, and "%" as interpolation syntax, which fails the whole config
after jail.local is written. Add Molecule cases for a scalar string and a
semicolon entry.

Document what review found: service_jail does not read the variable, the
[DEFAULT] value replaces an ignoreip set in jail.conf or jail.d/*.conf, a failed
hostname lookup leaves the entry ineffective with a log warning (addresses and
networks are safer), and --tags fail2ban_configure skips the validation.

Assisted-by: Claude Code
2026-11-15 13:20:43 +00:00
DragonishandClaude Sonnet 5.5 57b15df1ac feat(fail2ban): add fail2ban_ignoreip to exempt trusted addresses
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 26s
Molecule / molecule (pull_request) Successful in 52s
Write fail2ban_ignoreip as ignoreip in the [DEFAULT] section of jail.local, so
it applies to every jail, the service jails in jail.d included. The default is
Fail2Ban's own (127.0.0.1/8 and ::1). Entries are validated (no whitespace,
\Z-anchored) because they are joined into one line.

The first run after upgrading adds the [DEFAULT] section and restarts Fail2Ban
once.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q72rsMCgwaR1sbYZangwbp
2026-11-15 11:55:17 +00:00
Defame1297andClaude Opus 5.5 4d02dbbe60 fix(system_baseline): refuse a mapping as origins and document the pin's reach
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 34s
Molecule / molecule (pull_request) Successful in 1m43s
The origins check now refuses a dict, which Jinja's sequence test accepts.
The changelog states that the pve drop-in drops origins added in earlier
apt.conf.d files and names the opt-out; the README and the drop-in header
note that /etc/apt/apt.conf, read after apt.conf.d, can still add origins;
the verify play notes that the pve run rewrites the 50unattended-upgrades
keys and the ubuntu_lxc re-run restores them.

Refs defame1297/ansible-homelab-mono#349

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-14 22:23:49 +00:00
Defame1297andClaude Opus 5.5 52d06204bb feat(system_baseline): add an update toggle and pin the pve unattended-upgrades origins
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 35s
Molecule / molecule (pull_request) Successful in 1m46s
system_baseline_update (default true) lets the main flow skip the package
update for hosts patched by a separate, operator-run flow. The update entry
point does not read it: calling it is the request to update.

The new profile key unattended_upgrade_origins is rendered into
/etc/apt/apt.conf.d/90unattended-upgrades-origins, which #clears both
origin lists before setting the pinned patterns, because apt appends list
entries across files and a plain drop-in could only widen them. The pve
profile pins Debian's point-release and security origins, never the
Proxmox repository; the ubuntu profiles pin nothing and are unchanged.

Refs defame1297/ansible-homelab-mono#349

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-14 22:11:36 +00:00
Defame1297 873a40c48d Merge branch 'main' into feat/system-baseline-tmux
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 28s
Molecule / molecule (pull_request) Successful in 1m28s
2026-11-14 19:48:07 +00:00
Defame1297andClaude Opus 5.5 077d8715bf fix(ufw): install the ufw package in prepare and name system_baseline without its FQCN
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 25s
Molecule / molecule (pull_request) Successful in 7m55s
The rename to mortis.kamino.ufw also caught the package name in the scenario's prepare
step, so the package install failed. The role's docs named mortis.kamino.system_baseline,
which the role-independence test refuses; they now name the system_baseline role of this
Collection, and the README example no longer lists it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-14 16:52:22 +00:00
Defame1297andClaude Opus 5.5 e18db424ec feat(ufw): add the ufw role
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Failing after 25s
Molecule / molecule (pull_request) Failing after 5m42s
Copied from the environment repository's local role. The files are
identical except: galaxy namespace mortis; comments, argument_specs
descriptions and the README scrubbed of environment references (issue
numbers, CI runs, playbooks, inventory paths and groups, scripts and
caller roles by name), with the technical explanation kept and reworded
generically; the stray-variable guard's fail message drops its issue
reference; the molecule scenario calls the role by its FQCN
(mortis.kamino.ufw), follows the Kamino scenario conventions
(kamino-molecule header, scenario.test_sequence) and no longer sets
ANSIBLE_COLLECTIONS_PATH or ANSIBLE_ROLES_PATH. No variable, default,
argument_specs type or task logic changed; the test coverage is the same.

The README follows the other Kamino roles: purpose, the main,
service_rules and orphan_rules entry points, variables, and example
plays with the FQCN and tasks_from. The meta licence stays
GPL-3.0-or-later AND GPL-3.0-only (templates/before.rules.j2 is derived
from ufw's own file, already annotated in REUSE.toml and NOTICE).
galaxy.yml's dependency comment names ufw as a community.general user.

Not verified locally: the molecule scenario (it runs on the
kamino-molecule runner in CI) and ansible-test sanity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-14 16:43:29 +00:00
Dragonish da3389eac1 fix(system_baseline): keep tmux autostart from ending or swallowing logins
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 21s
Molecule / molecule (pull_request) Successful in 1m30s
Review of #122.

- A failed attach no longer closes the connection: the snippet does not exec tmux, it
  prints a line and leaves the plain shell (a client TERM without terminfo made every
  login fail). A clean detach still ends the connection.
- The snippet acts only for an interactive shell (case $-): a login shell that is not
  interactive, such as `ssh -t host 'bash -lc cmd'`, is left alone. Docs corrected.
- Validation anchors with \Z, so a trailing newline from a YAML block scalar is refused.
  It moves to validate.yml (tag always); argument_specs already covers types.
- Install keys on tmux being in the resolved package list, not a second profile list.
- verify.yml: the snippet does nothing without a terminal, the trailing-newline refusals,
  and the removal path. The vacuous pve assert is gone.
- README and argument_specs: window commands start with a minimal environment (use absolute
  paths), zsh and fish do not read /etc/profile.d, detach ends the connection.
2026-11-14 16:34:14 +00:00
DragonishandClaude Sonnet 5.5 dcdc9133f6 feat(system_baseline): optional tmux session on SSH login
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 20s
Molecule / molecule (pull_request) Successful in 1m40s
Adds tmux to the ubuntu_lxc and ubuntu_vm profiles and an opt-in
/etc/profile.d snippet that attaches an interactive SSH login to a tmux
session, created with configurable windows when it does not exist.

- system_baseline_tmux_autostart (default false), _session (default main)
  and _windows ([{name, command}]); only ubuntu_lxc and ubuntu_vm install
  the snippet, pve never does, and false removes it.
- profile.d is read only by an interactive login shell, so scp, sftp,
  ssh host command and automation are unaffected. ~/.no-tmux opts a user
  out. ForceCommand is not used: it would affect every session type.
- Names and commands are validated and shell-quoted; the script is
  root-owned. Commands run as the logging-in user and are world-readable,
  so they must hold no secret.
- Molecule converge enables it, verify checks ownership, mode, the attach
  line, the quoting and sh -n.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q72rsMEKREGMfB9DH3T9mR
2026-11-14 14:26:19 +00:00
Defame1297andClaude Sonnet 5.5 db4ba8d5c8 ci(molecule): use molecule-ubuntu2404 0.1.6 and drop the docker prepare gnupg task
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 20s
Molecule / molecule (pull_request) Successful in 6m7s
Moves the MOLECULE_IMAGE pin to 0.1.6, the build of #119 that carries gnupg, and
with it:

- removes the gnupg install (and its apt update) from the docker scenario's
  prepare, about 10 s of its 12 s; the role refreshes its own apt cache at
  install, so nothing relied on that update;
- adds gnupg to the image-smoke contract, so the image keeps providing it;
- drops gnupg from the docker README's list of what the scenario needs the
  Ubuntu mirrors for, with a trivial changelog fragment.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
2026-11-14 12:47:37 +00:00
Defame1297andClaude Sonnet 5.5 792b3414d3 ci(molecule): drop the leading destroy from every scenario's test sequence
The first destroy runs against a container that is not there and only waits out
the Docker driver's fixed 5 s poll, about 6 s per scenario and 42 s per full
run. The run step already removes what a killed run left, and molecule's state
file lives under the job's own ANSIBLE_HOME (Runtime(isolated=False)), which is
deleted with the checkout, so a cancelled run cannot make the next one skip
create or prepare. The rest of the sequence is molecule's default.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
2026-11-14 11:06:18 +00:00
Defame1297andClaude Opus 5.5 9c705a7f93 fix(system_baseline): declare dependencies and correct the review findings
Build / build (pull_request) Successful in 10s
Lint / lint (pull_request) Failing after 14s
Molecule / molecule (pull_request) Successful in 6m21s
- galaxy.yml declares community.general and ansible.posix: system_baseline is
  the first role that calls modules outside ansible.builtin, and a consumer
  that installs only this Collection failed to parse the play.
- The README override example set Automatic-Reboot to false, which every
  profile already defaults to; it now shows the opt-in.
- Comment and description wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-14 10:26:59 +00:00
Defame1297andClaude Opus 5.5 5abd1abe73 feat(system_baseline): add the system_baseline role
Copied from the environment repository's role and scrubbed for the
Collection, the same way as systemd_hardening and network_interfaces:
galaxy namespace mortis, the molecule scenario calls the role by its FQCN
and takes its paths from the workflow, the README example uses
mortis.kamino.system_baseline, and repository-local references (issue
numbers, ADRs, inventory paths, host anecdotes) are dropped. Profiles and
defaults are unchanged. The Legacy name guard and the molecule play that
tested it are dropped: the guard only protected the in-repo rename, and a
new consumer never had the old names. mock_roles in .ansible-lint lists
the FQCN.

The update and reboot task files are documented as supported entry
points (argument_specs and README): a caller that drives its own reboot,
such as a drain-aware Kubernetes node patch flow, imports them with
tasks_from and reads the system_baseline_reboot_required fact that
reboot sets. With system_baseline_reboot_if_required false, reboot only
computes the fact. Neither entry point has a required option. A new
verify play asserts the fact both ways and that the entry point does not
reboot.

Not verified locally: the molecule scenario (it runs on the
kamino-molecule runner in CI) and ansible-test sanity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-14 10:19:57 +00:00
Defame1297andClaude Sonnet 5.5 cf8f4b5bf0 feat(roles): add the systemd_hardening and network_interfaces roles
Build / build (pull_request) Successful in 10s
Lint / lint (pull_request) Successful in 17s
Molecule / molecule (pull_request) Successful in 4m43s
Copied from the environment repository's roles and scrubbed for the
Collection: galaxy namespace mortis, molecule scenarios call the roles by
their FQCN and take their paths from the workflow, README examples use
mortis.kamino.* and documentation addresses, repository-local references
(issue numbers, ADRs, inventory paths) are dropped. network_interfaces
loses its Legacy name guard and the molecule play that tested it: the
guard only protected the in-repo rename, and a new consumer never had the
old names. mock_roles in .ansible-lint lists both FQCNs.

Not verified locally: the molecule scenarios (they run on the
kamino-molecule runner in CI) and ansible-test sanity.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-10 15:09:48 +00:00
Defame1297andClaude Sonnet 5.5 1ea478b124 feat(fail2ban): add the fail2ban role
Build / build (pull_request) Successful in 23s
Lint / lint (pull_request) Successful in 16s
Molecule / molecule (pull_request) Successful in 3m11s
Copied from the environment repository's roles/fail2ban and scrubbed for the
Collection: galaxy namespace mortis, the molecule scenario calls the role by
its FQCN (and takes its paths from the workflow, like docker's), README
examples use mortis.kamino.fail2ban, repository-local issue references are
dropped. mock_roles in .ansible-lint lists the new FQCN.

Not verified locally: the molecule scenario (runs on the kamino-molecule
runner in CI) and ansible-test sanity.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-08 21:20:08 +00:00
Defame1297andClaude Sonnet 5.5 aad59fc339 feat(docker): add the docker role (#522)
Build / build (pull_request) Failing after 22s
Lint / lint (pull_request) Successful in 15s
Molecule / molecule (pull_request) Successful in 2m18s
Extracted from the environment repository, wave 1. Scrubbed of private
references: namespace mortis, no repository paths or issue numbers in
comments and docs, the removed docker_ufw_rules guard dropped, the molecule
scenario uses the FQCN and no provisioner environment overrides.
ansible-lint mocks the role's FQCN because CI checks the Collection out
outside an ansible_collections path.

Verified: the commit hooks. Not verified: the molecule scenario (CI only).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-08 18:59:26 +00:00
Defame1297andClaude Sonnet 5.5 c794d3133a feat: add the empty mortis.kamino collection skeleton
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-10-24 21:10:20 +00:00