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
@@ -17,6 +17,16 @@
|
||||
- "'telnet' not in ansible_facts.packages"
|
||||
quiet: true
|
||||
|
||||
# jq was absent before the role ran and is on no profile list: the extra list installed it, and the profile's own packages (tmux,
|
||||
# curl above) are still there. ed was present and is on no profile list: the extra remove list purged it.
|
||||
- name: The extra packages were installed and the extra removal purged
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'jq' in ansible_facts.packages"
|
||||
- "'curl' in ansible_facts.packages"
|
||||
- "'ed' not in ansible_facts.packages"
|
||||
quiet: true
|
||||
|
||||
- name: Read the journald drop-in
|
||||
ansible.builtin.slurp:
|
||||
src: /etc/systemd/journald.conf.d/50-system-baseline.conf
|
||||
@@ -254,6 +264,51 @@
|
||||
that: not system_baseline_verify_removed.stat.exists
|
||||
quiet: true
|
||||
|
||||
# An extra tmux counts like a profile tmux: a flat package list without it installs no snippet, the same list plus the extra does.
|
||||
- name: Run the tmux tasks with a flat package list that lacks tmux
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.system_baseline
|
||||
tasks_from: tmux
|
||||
vars:
|
||||
system_baseline_system_type: ubuntu_lxc
|
||||
system_baseline_tmux_autostart: true
|
||||
system_baseline_essential_packages: [vim]
|
||||
|
||||
- name: Stat the snippet without the extra
|
||||
ansible.builtin.stat:
|
||||
path: /etc/profile.d/tmux-autostart.sh
|
||||
register: system_baseline_verify_no_extra
|
||||
|
||||
- name: Run the tmux tasks with tmux as an extra package
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.system_baseline
|
||||
tasks_from: tmux
|
||||
vars:
|
||||
system_baseline_system_type: ubuntu_lxc
|
||||
system_baseline_tmux_autostart: true
|
||||
system_baseline_essential_packages: [vim]
|
||||
system_baseline_extra_packages: [tmux]
|
||||
|
||||
- name: Stat the snippet with the extra
|
||||
ansible.builtin.stat:
|
||||
path: /etc/profile.d/tmux-autostart.sh
|
||||
register: system_baseline_verify_with_extra
|
||||
|
||||
- name: Only the extra tmux installs the snippet
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- not system_baseline_verify_no_extra.stat.exists
|
||||
- system_baseline_verify_with_extra.stat.exists
|
||||
quiet: true
|
||||
|
||||
- name: Remove the snippet again
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.system_baseline
|
||||
tasks_from: tmux
|
||||
vars:
|
||||
system_baseline_system_type: ubuntu_lxc
|
||||
system_baseline_tmux_autostart: false
|
||||
|
||||
# The pve origins pin, run on this Ubuntu host: Ubuntu's 50unattended-upgrades sets Allowed-Origins, so the merged
|
||||
# configuration showing only the pinned patterns proves the drop-in clears the earlier lists instead of appending to them.
|
||||
# The patterns match no Ubuntu origin, which only means nothing would be upgraded; the role's dry run still passes. Here
|
||||
|
||||
Reference in new issue
Block a user