feat(system_baseline): add the system_baseline role #114

Merged
Defame1297 merged 3 commits from feat/system-baseline-role into main 2026-11-14 10:41:19 +00:00
Owner

Moves system_baseline from the environment repository into the Collection, in the same way as #78.

What changed compared with the environment copy

  • No behaviour change. Tasks, defaults, profiles, handlers, tags, when and become are identical. A reviewer checked this with diff -r: only comments and docs differ.
  • meta/main.yml: namespace is mortis. The galaxy description now mentions the journal cap.
  • The Legacy name guard has been removed: guards go with the move. The two system_baseline_system_type asserts stay.
  • Supported entry points: update and reboot are now documented in argument_specs and the README as a public interface, as well as main. reboot sets the fact system_baseline_reboot_required. With system_baseline_reboot_if_required: false it only computes the fact and does not reboot. The environment repo's rke2 role uses these for its drain-aware patching, so renaming them is a breaking change.
  • galaxy.yml now declares community.general >=14.0.0 and ansible.posix >=2.2.0. This is the first role that calls modules outside ansible.builtin (locale_gen, timezone, sysctl, mount). Without the declaration, a consumer that installs only this Collection fails when the play is parsed. The lower bounds are the versions CI tests against. There is no upper bound. The environment repo already pins 14.0.0 and 2.2.2, so its install is unchanged.
  • Comments and README no longer refer to environment-repo internals (issue numbers, ADRs, inventory paths, host names).
  • Molecule:
    • The scenario is adapted to Kamino conventions: FQCN, and no env block.
    • The legacy-guard play has been removed.
    • A new verify play calls tasks_from: reboot with and without /var/run/reboot-required and asserts that the fact is false, then true, with no reboot.
    • All the earlier assertions are kept, including the ubuntu_vm Automatic-Reboot default and the opt-in.
  • .ansible-lint mock_roles entry and a changelog fragment.

Checked locally

  • Pre-commit hooks pass: yamllint, ansible-lint (production profile), REUSE, changelog lint, gitleaks.
  • ansible-galaxy collection build and scripts/check_tarball.py pass (114 entries).
  • Argument-spec validation of main, update and reboot passes with the environment repo's inventory inputs (reviewer, --check --tags nomatch against localhost).

Not verified locally

The molecule run and ansible-test sanity run only in CI.

After merge

Release PR (1.3.0), then the environment repo takes the pin, the runner image and the cutover.

🤖 Generated with Claude Code

Moves `system_baseline` from the environment repository into the Collection, in the same way as #78. ## What changed compared with the environment copy - **No behaviour change.** Tasks, defaults, profiles, handlers, tags, `when` and `become` are identical. A reviewer checked this with `diff -r`: only comments and docs differ. - `meta/main.yml`: namespace is `mortis`. The galaxy description now mentions the journal cap. - The Legacy name guard has been removed: guards go with the move. The two `system_baseline_system_type` asserts stay. - **Supported entry points:** `update` and `reboot` are now documented in `argument_specs` and the README as a public interface, as well as `main`. `reboot` sets the fact `system_baseline_reboot_required`. With `system_baseline_reboot_if_required: false` it only computes the fact and does not reboot. The environment repo's `rke2` role uses these for its drain-aware patching, so renaming them is a breaking change. - **`galaxy.yml` now declares `community.general >=14.0.0` and `ansible.posix >=2.2.0`.** This is the first role that calls modules outside `ansible.builtin` (`locale_gen`, `timezone`, `sysctl`, `mount`). Without the declaration, a consumer that installs only this Collection fails when the play is parsed. The lower bounds are the versions CI tests against. There is no upper bound. The environment repo already pins 14.0.0 and 2.2.2, so its install is unchanged. - Comments and README no longer refer to environment-repo internals (issue numbers, ADRs, inventory paths, host names). - Molecule: - The scenario is adapted to Kamino conventions: FQCN, and no `env` block. - The legacy-guard play has been removed. - A new verify play calls `tasks_from: reboot` with and without `/var/run/reboot-required` and asserts that the fact is false, then true, with no reboot. - All the earlier assertions are kept, including the ubuntu_vm `Automatic-Reboot` default and the opt-in. - `.ansible-lint` `mock_roles` entry and a changelog fragment. ## Checked locally - Pre-commit hooks pass: yamllint, ansible-lint (production profile), REUSE, changelog lint, gitleaks. - `ansible-galaxy collection build` and `scripts/check_tarball.py` pass (114 entries). - Argument-spec validation of `main`, `update` and `reboot` passes with the environment repo's inventory inputs (reviewer, `--check --tags nomatch` against localhost). ## Not verified locally The molecule run and `ansible-test sanity` run only in CI. ## After merge Release PR (`1.3.0`), then the environment repo takes the pin, the runner image and the cutover. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added 2 commits 2026-11-14 10:27:45 +00:00
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
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
9c705a7f93
- 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
Defame1297 added 1 commit 2026-11-14 10:32:49 +00:00
fix(lint): mock the dependency modules system_baseline calls
Build / build (pull_request) Successful in 10s
Lint / lint (pull_request) Successful in 19s
Molecule / molecule (pull_request) Successful in 6m18s
424f76c164
Lint runs offline in the ci image, which bakes no collections, so
community.general and ansible.posix modules could not be resolved
(syntax-check[unknown-module]). Mock them as the scenarios' roles are
mocked; molecule runs them against the installed collections.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Defame1297 scheduled this pull request to auto merge when all checks succeed 2026-11-14 10:36:28 +00:00
Defame1297 merged commit 2721509cde into main 2026-11-14 10:41:19 +00:00
Defame1297 deleted branch feat/system-baseline-role 2026-11-14 10:41:19 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#114