Role interface and semver: output facts, handler names, dropped platforms and internal roles #257

Closed
opened 2026-11-17 22:24:56 +00:00 by Claude · 2 comments
Owner

Part of #87

The role standard says what an input is and that renaming one is a major release. It does not say whether the other things a consumer can depend on are part of the interface.

To decide

  1. Is a fact that a role sets for its caller, documented under "Variables set by the role", part of the interface? If yes it keeps <role>_ and renaming it is a breaking_changes fragment. Three exist today: system_baseline_reboot_required, user_management_all_users, user_management_managed_usernames.
  2. Are handler names and tags part of the interface in the same way?
  3. Is removing a platform that was declared but never tested (jammy, Ubuntu all, Debian all) a breaking_changes fragment, like the 2.19 floor? If yes, should it ship in the same major as the floor raise? Does the interim removal of trixie from four roles, until the Debian image exists, need a fragment at all?
  4. Does the Collection have internal roles? If yes: what one must have (argument_specs, README, scenario, a row in the README table), whether its interface is outside semver, whether another role may call it although the dependency rule asks for a supported entry point, and how its name passes ansible-lint's role-name. The README Roadmap already announces one.
  5. Check-mode guards: is the ufw probe task a third allowed guard, or is it replaced by ansible_check_mode?
  6. warn_list: does enabling complexity keep jinja[spacing] and fqcn[deep] as warnings, or do they become failures?

Waits on this

Blocked by this ticket: refactor(roles): validate through spec keys and validate.yml, and prefix internal variables with _ROLE (question 1) and test(roles): run every role scenario on 24.04 and 26.04 and declare exactly those platforms (question 3). Questions 5 and 6 are answered by a comment on the check-step and complexity issues.

Evidence is in the first comment.

Part of #87 The role standard says what an input is and that renaming one is a major release. It does not say whether the other things a consumer can depend on are part of the interface. ## To decide 1. Is a fact that a role sets for its caller, documented under "Variables set by the role", part of the interface? If yes it keeps `<role>_` and renaming it is a `breaking_changes` fragment. Three exist today: `system_baseline_reboot_required`, `user_management_all_users`, `user_management_managed_usernames`. 2. Are handler names and tags part of the interface in the same way? 3. Is removing a platform that was declared but never tested (`jammy`, Ubuntu `all`, Debian `all`) a `breaking_changes` fragment, like the 2.19 floor? If yes, should it ship in the same major as the floor raise? Does the interim removal of `trixie` from four roles, until the Debian image exists, need a fragment at all? 4. Does the Collection have internal roles? If yes: what one must have (argument_specs, README, scenario, a row in the README table), whether its interface is outside semver, whether another role may call it although the dependency rule asks for a supported entry point, and how its name passes ansible-lint's `role-name`. The README Roadmap already announces one. 5. Check-mode guards: is the `ufw` probe task a third allowed guard, or is it replaced by `ansible_check_mode`? 6. `warn_list`: does enabling `complexity` keep `jinja[spacing]` and `fqcn[deep]` as warnings, or do they become failures? ## Waits on this Blocked by this ticket: [refactor(roles): validate through spec keys and validate.yml, and prefix internal variables with __ROLE_](https://git.rkdr.net/Mortis/Kamino/issues/137) (question 1) and [test(roles): run every role scenario on 24.04 and 26.04 and declare exactly those platforms](https://git.rkdr.net/Mortis/Kamino/issues/133) (question 3). Questions 5 and 6 are answered by a comment on the check-step and complexity issues. Evidence is in the first comment.
Claude added the
Wayfinder
Grilling
label 2026-11-17 22:24:56 +00:00
Defame1297 was assigned by Claude 2026-11-17 22:24:56 +00:00
Author
Owner

Evidence from the review of the map (2026-11-17)

Output facts and handler names

Dropped platforms

Internal roles

  • README.md:43: "Wave 2: _binary_update (internal shared binary-update logic, called only by Collection roles; ships with traefik)". ansible-lint 26.10.1: "role-name: Role name _binary_update does not match ^[a-z][a-z0-9_]*$ pattern."
  • Rule 11 of the gaps decision: a role may depend on another "only on a supported entry point of that role".
  • Low severity today: nothing is built wrong until that role is extracted.

The two either-or lines

## Evidence from the review of the map (2026-11-17) **Output facts and handler names** - [Role standard](https://git.rkdr.net/Mortis/Kamino/issues/93): "internal variables (`vars/`, `set_fact`, `register:`) `__<role>_`", and the README heading "Variables set by the role (when any)". - [refactor(roles): validate through spec keys and validate.yml, and prefix internal variables with __ROLE_](https://git.rkdr.net/Mortis/Kamino/issues/137): "renamed from `<role>_` to `__<role>_` in every role" and "No role changes what it does on a host." - `roles/system_baseline/README.md:62`: the fact `system_baseline_reboot_required`, "so read it with `default(false)`". `roles/user_management/README.md:58`: "The role sets the facts `user_management_all_users` ... and `user_management_managed_usernames`." - [Role standard gaps found in review](https://git.rkdr.net/Mortis/Kamino/issues/214), rule 6, covers "an input (a variable without `__`)" only. - [feat(fail2ban): reload instead of restart when jail.local changes](https://git.rkdr.net/Mortis/Kamino/issues/157): "handler names are global in a play, so a role outside this collection that notifies it by name would otherwise fail". **Dropped platforms** - [What a role's platform declaration means, and supported entry points](https://git.rkdr.net/Mortis/Kamino/issues/207): "`jammy` and Ubuntu `all` are dropped everywhere." [Supported and tested ansible-core versions](https://git.rkdr.net/Mortis/Kamino/issues/206), item 3: "Every floor raise is a major release, this first one included." The README issue lists "dropping an Ubuntu release" under Major. - Today: `jammy` in sshd, system_baseline, systemd_hardening, ufw and user_management; Ubuntu `all` in docker; Debian `all` in network_interfaces. **Internal roles** - `README.md:43`: "Wave 2: `_binary_update` (internal shared binary-update logic, called only by Collection roles; ships with `traefik`)". ansible-lint 26.10.1: "role-name: Role name _binary_update does not match ``^[a-z][a-z0-9_]*$`` pattern." - Rule 11 of the gaps decision: a role may depend on another "only on a supported entry point of that role". - Low severity today: nothing is built wrong until that role is extracted. **The two either-or lines** - [test(roles): run molecule's check step before and after converge](https://git.rkdr.net/Mortis/Kamino/issues/134), comment of 2026-11-16: "either keep it and record it as a third allowed guard ... or replace it with `ansible_check_mode` as its own change." - [ci(lint): enable and gate ansible-lint's complexity rule](https://git.rkdr.net/Mortis/Kamino/issues/138), comment of 2026-11-16: "either set `warn_list: [jinja[spacing], fqcn[deep]]` ... or state that promoting both is intended."
Author
Owner

Resolution (2026-11-20)

Facts checked first (scratch copy, repository unchanged):

  • _binary_update shipped in 1.8.0: argument_specs, a README opening "Internal role … its interface can change in any release, without a major version", two Molecule scenarios, a guard that refuses to run without a parent role, called by traefik with an FQCN include_role. role-name is skipped repository-wide in .ansible-lint.
  • On ansible-core 2.22.0, a play-level check_mode: true leaves ansible_check_mode False, inside include_role and in the play's own tasks; the ufw probe is skipped either way. _binary_update, traefik and user_management guard with ansible_check_mode.
  • With warn_list: [], complexity enabled and the role-name skip removed, the only new ansible-lint finding is role-name on roles/_binary_update; there are no jinja[spacing], fqcn[deep] or complexity findings. A line roles/_binary_update role-name in .ansible-lint-ignore makes that run pass.

Decisions

  1. Output facts are interface. A fact a role sets for its caller and documents under "Variables set by the role" (system_baseline_reboot_required, user_management_all_users, user_management_managed_usernames) keeps <role>_; renaming or removing one is breaking_changes. Every other fact or registered variable is __<role>_. Held by review.
  2. Handlers are not interface. A caller never notifies a role's handler; a README names one only to explain behaviour; renaming or removing one needs no fragment. A caller that needs a restart does it in its own tasks. Held by review.
  3. Documented tags are interface. A tag in the README's ## Tags section: renaming or removing it is breaking_changes, adding one is minor_changes. An unlisted tag is internal. Held by review.
  4. Removing or narrowing a declared platform is breaking_changes, tested or not (jammy in five roles, Ubuntu all in docker, Debian all in network_interfaces). These removals ship in the same major as the ansible-core floor raise (2.0.0): the maintainer leaves the release pull request unmerged until both have landed (aspirational). Held by a control: the fragment-presence check fails when a declared platform disappears without a breaking_changes fragment.
  5. No interim removal of trixie. The platforms issue leaves it declared; the Debian 13 image makes the declaration true. Accepted: trixie is declared but untested until then, as it is today.
  6. Internal roles exist, following the _binary_update pattern: a leading _ marks one; only roles of this Collection call it, by FQCN; it refuses to run without a parent role (control); it has argument_specs, a README opening with the internal-role statement, Molecule scenarios and the platform rule; no row in the README's role table, one line under it naming internal roles. Its interface is outside semver: a change confined to it takes a trivial fragment, and the calling role writes the fragment for any effect a consumer can see. Rule 11 is extended: a role calls a public role only on a supported entry point, an internal role on any entry point in its argument_specs.
  7. role-name is exempted per internal role: roles/_binary_update role-name in .ansible-lint-ignore replaces the repository-wide skip, so a misnamed public role fails. Each new internal role adds its own line, reviewed.
  8. No __ split in an internal role. All its variables keep _<role>_ (today _binary_update_*); its inputs are known from argument_specs.
  9. One check-mode guard. The allowed guards are check_mode: false on read-only probes and when: not ansible_check_mode; --check is the supported preview, and each role README says a play-level check_mode: true is not supported. The ufw probe is replaced in its own change.
  10. warn_list: []. It promotes nothing today. A future experimental rule that fires fails its Renovate pull request, which then does not automerge.
  11. Rules 1, 2, 3, 8 and the __ marker are held by review; rule 4 by control once the fragment check is extended.
  12. Glossary: Role interface (what a consumer of a role may depend on: its inputs, supported entry points, documented output facts and documented tags; avoid API, public surface) and Internal role (a role that only other roles of the Collection call; its interface is not part of the Collection's versioning promise; avoid private role, helper role), added through the glossary issue.

No ADR: none of these is hard to reverse, and none would surprise a reader who has the rule.

Backlog

## Resolution (2026-11-20) **Facts checked first** (scratch copy, repository unchanged): - `_binary_update` shipped in 1.8.0: argument_specs, a README opening "Internal role … its interface can change in any release, without a major version", two Molecule scenarios, a guard that refuses to run without a parent role, called by `traefik` with an FQCN `include_role`. `role-name` is skipped repository-wide in `.ansible-lint`. - On ansible-core 2.22.0, a play-level `check_mode: true` leaves `ansible_check_mode` False, inside `include_role` and in the play's own tasks; the ufw probe is skipped either way. `_binary_update`, `traefik` and `user_management` guard with `ansible_check_mode`. - With `warn_list: []`, `complexity` enabled and the `role-name` skip removed, the only new ansible-lint finding is `role-name` on `roles/_binary_update`; there are no `jinja[spacing]`, `fqcn[deep]` or `complexity` findings. A line `roles/_binary_update role-name` in `.ansible-lint-ignore` makes that run pass. **Decisions** 1. **Output facts are interface.** A fact a role sets for its caller and documents under "Variables set by the role" (`system_baseline_reboot_required`, `user_management_all_users`, `user_management_managed_usernames`) keeps `<role>_`; renaming or removing one is `breaking_changes`. Every other fact or registered variable is `__<role>_`. Held by review. 2. **Handlers are not interface.** A caller never notifies a role's handler; a README names one only to explain behaviour; renaming or removing one needs no fragment. A caller that needs a restart does it in its own tasks. Held by review. 3. **Documented tags are interface.** A tag in the README's `## Tags` section: renaming or removing it is `breaking_changes`, adding one is `minor_changes`. An unlisted tag is internal. Held by review. 4. **Removing or narrowing a declared platform is `breaking_changes`**, tested or not (`jammy` in five roles, Ubuntu `all` in docker, Debian `all` in network_interfaces). These removals ship in the same major as the ansible-core floor raise (2.0.0): the maintainer leaves the release pull request unmerged until both have landed (aspirational). Held by a control: the fragment-presence check fails when a declared platform disappears without a `breaking_changes` fragment. 5. **No interim removal of `trixie`.** The platforms issue leaves it declared; the Debian 13 image makes the declaration true. Accepted: `trixie` is declared but untested until then, as it is today. 6. **Internal roles exist**, following the `_binary_update` pattern: a leading `_` marks one; only roles of this Collection call it, by FQCN; it refuses to run without a parent role (control); it has argument_specs, a README opening with the internal-role statement, Molecule scenarios and the platform rule; no row in the README's role table, one line under it naming internal roles. Its interface is outside semver: a change confined to it takes a `trivial` fragment, and the calling role writes the fragment for any effect a consumer can see. Rule 11 is extended: a role calls a public role only on a supported entry point, an internal role on any entry point in its argument_specs. 7. **`role-name` is exempted per internal role**: `roles/_binary_update role-name` in `.ansible-lint-ignore` replaces the repository-wide skip, so a misnamed public role fails. Each new internal role adds its own line, reviewed. 8. **No `__` split in an internal role.** All its variables keep `_<role>_` (today `_binary_update_*`); its inputs are known from argument_specs. 9. **One check-mode guard.** The allowed guards are `check_mode: false` on read-only probes and `when: not ansible_check_mode`; `--check` is the supported preview, and each role README says a play-level `check_mode: true` is not supported. The ufw probe is replaced in its own change. 10. **`warn_list: []`.** It promotes nothing today. A future experimental rule that fires fails its Renovate pull request, which then does not automerge. 11. Rules 1, 2, 3, 8 and the `__` marker are held by review; rule 4 by control once the fragment check is extended. 12. **Glossary:** *Role interface* (what a consumer of a role may depend on: its inputs, supported entry points, documented output facts and documented tags; avoid API, public surface) and *Internal role* (a role that only other roles of the Collection call; its interface is not part of the Collection's versioning promise; avoid private role, helper role), added through the glossary issue. No ADR: none of these is hard to reverse, and none would surprise a reader who has the rule. **Backlog** - New: [refactor(roles): detect check mode only with ansible_check_mode](https://git.rkdr.net/Mortis/Kamino/issues/271). - Scope comments on #133, #134, #137, #138, #157, #181, #183, #190, #215.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#257