feat(system_baseline): add inputs that append packages to the profile's lists
system_baseline_essential_packages and system_baseline_remove_packages replace the whole list, and so does a list inside system_baseline_profile_overrides, so adding one package meant repeating the profile's list and keeping it in step with every release. system_baseline_extra_packages and system_baseline_extra_remove_packages (lists, default empty) append to the resolved lists. The tmux and unattended-upgrades checks read the combined list, so an extra tmux or unattended-upgrades enables the matching task like a profile package. Items must be Debian package names: a null item would have become the package "None", and apt reads a trailing minus (jq-) as a removal. A package that one input installs and another purges stops the run before any change; only overlaps that involve an extra are checked, so a consumer's own overlap between the resolved lists behaves as before. A flat input that is a plain string still counts as a one-item list. With both inputs left at their default the role behaves as before. Closes #399 Assisted-by: Claude Code:claude-sonnet-5-5
This commit is contained in:
1 parent
aa4e8c68a7
commit
d5a91520df
12 files changed
+269
-14
No files matched your search
@@ -0,0 +1,21 @@
|
||||
---
|
||||
# One refusal per call: the role must stop on validation, before it changes anything, with a message that names the inputs.
|
||||
# The case comes in as system_baseline_refused_case: {install, remove, expect}.
|
||||
- name: Run the role with a bad extra package list
|
||||
block:
|
||||
- name: Include system_baseline
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.system_baseline
|
||||
vars:
|
||||
system_baseline_system_type: ubuntu_lxc
|
||||
system_baseline_extra_packages: "{{ system_baseline_refused_case.install | default([]) }}"
|
||||
system_baseline_extra_remove_packages: "{{ system_baseline_refused_case.remove | default([]) }}"
|
||||
- name: Unreachable when validation works
|
||||
ansible.builtin.fail:
|
||||
msg: system_baseline ran with a bad extra package list
|
||||
rescue:
|
||||
- name: The validation stopped the play with the expected message
|
||||
ansible.builtin.assert:
|
||||
that: system_baseline_refused_case.expect in ansible_failed_result.msg | default('')
|
||||
fail_msg: "Expected '{{ system_baseline_refused_case.expect }}', got: {{ ansible_failed_result.msg | default('') }}"
|
||||
quiet: true
|
||||
Reference in new issue
Block a user