From 9c705a7f93240b48b691ccb1efa3d27655db874f Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Sat, 14 Nov 2026 10:26:59 +0000 Subject: [PATCH] fix(system_baseline): declare dependencies and correct the review findings - 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 Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm --- README.md | 3 +++ changelogs/fragments/system-baseline-role.yml | 3 +++ galaxy.yml | 6 +++++- roles/system_baseline/README.md | 6 +++--- roles/system_baseline/meta/main.yml | 2 +- roles/system_baseline/molecule/default/converge.yml | 2 +- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8fef32f..467af82 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ collections: version: v1.2.0 ``` +Its dependencies (`community.general`, `ansible.posix`) are declared in `galaxy.yml`, so +`ansible-galaxy` installs them unless the same file already pins a satisfying version. + ```yaml - ansible.builtin.include_role: name: mortis.kamino. diff --git a/changelogs/fragments/system-baseline-role.yml b/changelogs/fragments/system-baseline-role.yml index cc1aa04..2ee195a 100644 --- a/changelogs/fragments/system-baseline-role.yml +++ b/changelogs/fragments/system-baseline-role.yml @@ -4,3 +4,6 @@ minor_changes: mounts and an optional reboot). Besides ``main``, the ``update`` and ``reboot`` task files are supported entry points for callers that drive their own reboot; ``reboot`` sets the ``system_baseline_reboot_required`` fact. + - galaxy.yml - Declare ``community.general`` (>=14.0.0) and ``ansible.posix`` (>=2.2.0) as + dependencies, needed by ``system_baseline``. ``ansible-galaxy`` now installs them with the + Collection unless the consumer's requirements already pin a satisfying version. diff --git a/galaxy.yml b/galaxy.yml index dc1fd78..0b8a3db 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -17,7 +17,11 @@ repository: https://git.rkdr.net/mortis/kamino documentation: https://git.rkdr.net/mortis/kamino/src/branch/main/README.md homepage: https://git.rkdr.net/mortis/kamino issues: https://git.rkdr.net/mortis/kamino/issues -dependencies: {} +# Lower bounds are the versions CI tests against; no upper bound, so a consumer's +# newer pin does not conflict. Used by system_baseline. +dependencies: + community.general: ">=14.0.0" + ansible.posix: ">=2.2.0" build_ignore: # Repository tooling that is not part of the Collection. scripts/check_tarball.py fails # the build if anything outside its allowlist ends up in the archive, so a new top-level diff --git a/roles/system_baseline/README.md b/roles/system_baseline/README.md index 2de2e91..3370d07 100644 --- a/roles/system_baseline/README.md +++ b/roles/system_baseline/README.md @@ -40,13 +40,13 @@ templating error instead of the role's own message. | `system_baseline_locale` | `en_US.UTF-8` | no | Locale | | `system_baseline_reboot_if_required` | `true` | no | Reboot when `/var/run/reboot-required` exists | -A flat `system_baseline_*` input replaces that value entirely. To change one key of a profile dict, use `system_baseline_profile_overrides`, for example to keep unattended-upgrades from rebooting a group: +A flat `system_baseline_*` input replaces that value entirely. To change one key of a profile dict, use `system_baseline_profile_overrides`, for example to let unattended-upgrades reboot a group on its own: ```yaml system_baseline_profile_overrides: ubuntu_vm: unattended_upgrade_settings: - "Unattended-Upgrade::Automatic-Reboot": false + "Unattended-Upgrade::Automatic-Reboot": true ``` ## Entry points @@ -95,7 +95,7 @@ Besides `main`, two task files are a supported interface, for a caller that driv ## Notes - The `pve` profile has no `ufw`; the `ubuntu_*` profiles install it and `fail2ban`. -- The `ubuntu_vm` profile does not let unattended-upgrades reboot on its own (`Automatic-Reboot: false`); a host opts in through `system_baseline_profile_overrides`. +- No profile lets unattended-upgrades reboot on its own (`Automatic-Reboot: false`); a host opts in through `system_baseline_profile_overrides`. - Set `system_baseline_reboot_if_required: false` for hosts whose reboot takes other machines down (hypervisors) or needs a drain first (cluster nodes). - Molecule skips `sysctl`, `secure_tmp`, `update` and `timezone` (no privileged container); see `molecule/default/molecule.yml`. - Policy lives in defaults, not `vars/`, so group_vars and host_vars can override it. diff --git a/roles/system_baseline/meta/main.yml b/roles/system_baseline/meta/main.yml index 306a23c..ce32cd5 100644 --- a/roles/system_baseline/meta/main.yml +++ b/roles/system_baseline/meta/main.yml @@ -4,7 +4,7 @@ galaxy_info: namespace: mortis author: Defame1297 license: GPL-3.0-or-later - description: "Per-system-type OS baseline: apt upgrade, packages, unattended-upgrades, locale, timezone, sysctl, tmpfs mounts, reboot." + description: "Per-system-type OS baseline: apt upgrade, packages, unattended-upgrades, locale, timezone, journal cap, sysctl, tmpfs mounts, reboot." min_ansible_version: "2.19" platforms: - name: Ubuntu diff --git a/roles/system_baseline/molecule/default/converge.yml b/roles/system_baseline/molecule/default/converge.yml index 8a3e7f0..2cbb555 100644 --- a/roles/system_baseline/molecule/default/converge.yml +++ b/roles/system_baseline/molecule/default/converge.yml @@ -70,7 +70,7 @@ - system_baseline_sysctl_hardening | selectattr('name', 'equalto', 'net.ipv4.conf.all.log_martians') | list | length == 1 quiet: true -# Play vars sit below the old include_vars, so these overrides were silently ignored before. +# Consumer play vars override the profile. - name: Consumer overrides win over the profile hosts: all gather_facts: false