Compare commits

..
Author SHA1 Message Date
Defame1297 0973f39831 feat: refresh the APT cache on distribution-only installs when stale
Build / build (pull_request) Successful in 29s
Lint / lint (pull_request) Successful in 2m18s
Molecule / molecule (pull_request) Canceled after 26m49s
The docker prerequisites and the system_baseline packages install only
from the distribution's sources, yet refreshed the APT cache on every
run. They now pass cache_valid_time: 3600, as the system_baseline update
task and user_management already do.

The docker and tailscale installs from the role's own APT source keep
refreshing on every run, so a run that wrote the source line but failed
to fetch its lists heals on the next run. The update entry points are
unchanged.

The system_baseline README tells a consumer who adds a source just
before the role to refresh the cache themselves.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-27 15:10:32 +00:00
9 changed files with 17 additions and 22 deletions

No files matched your search

-13
View File
@@ -1,13 +0,0 @@
---
# Merged under every scenario's molecule.yml. prerun off: the CI wrapper puts this checkout
# first on ANSIBLE_COLLECTIONS_PATH, so molecule's per-scenario install is unused.
prerun: false
provisioner:
config_options:
connection:
# Pipe each module over stdin: without it every task pays extra docker exec and docker cp
# calls to make a temp dir, copy the module in and clean up.
pipelining: true
defaults:
# Gather each host's facts once per playbook run, not in every play.
gathering: smart
+3 -4
View File
@@ -85,10 +85,9 @@ issue.
- **A role named in an include, import, play `roles:` entry or meta dependency is written out in - **A role named in an include, import, play `roles:` entry or meta dependency is written out in
full**, never bare or templated. *Why:* the selector finds dependent roles by their FQCN. full**, never bare or templated. *Why:* the selector finds dependent roles by their FQCN.
*Held:* control: a selector test fails a bare or templated name. *Held:* control: a selector test fails a bare or templated name.
- **Scenarios load `mortis.kamino` from the checkout, never from an installed copy, so - **Scenarios load `mortis.kamino` from the checkout, never from molecule's installed copy, so
`galaxy.yml` is on IGNORED.** *Why:* the checkout is first on `ANSIBLE_COLLECTIONS_PATH` and the `galaxy.yml` is on IGNORED.** *Why:* molecule installs the collection from `galaxy.yml` into
shared base config `.config/molecule/config.yml` turns off molecule's install of the collection each scenario's `ANSIBLE_HOME`, which is not on `ANSIBLE_COLLECTIONS_PATH`, so its changes
(`prerun: false`), so changes to `galaxy.yml`
(release versions, `build_ignore`) do not change what a scenario runs, and the Build check (release versions, `build_ignore`) do not change what a scenario runs, and the Build check
proves the collection builds; they had caused about a third of full pull request runs and their proves the collection builds; they had caused about a third of full pull request runs and their
minutes (#338). *Held:* control: `scripts/check_scenarios_load_checkout.py`, which minutes (#338). *Held:* control: `scripts/check_scenarios_load_checkout.py`, which
@@ -0,0 +1,7 @@
---
minor_changes:
- >-
docker, system_baseline - The install tasks that only use the distribution's sources (docker's
prerequisites, system_baseline's packages) refresh the APT cache only when it is older than an
hour; before, every run refreshed it. Installs from a role's own APT source still refresh it on
every run.
-1
View File
@@ -39,7 +39,6 @@ build_ignore:
- apm_modules - apm_modules
- .apm-local - .apm-local
- .claude - .claude
- .config
- .gitea - .gitea
- .gitignore - .gitignore
- .pre-commit-config.yaml - .pre-commit-config.yaml
+2
View File
@@ -7,6 +7,7 @@
- curl - curl
state: present state: present
update_cache: true update_cache: true
cache_valid_time: 3600
tags: [docker, install] tags: [docker, install]
- name: Ensure APT keyrings directory exists - name: Ensure APT keyrings directory exists
@@ -40,6 +41,7 @@
ansible.builtin.apt: ansible.builtin.apt:
name: "{{ docker_packages }}" name: "{{ docker_packages }}"
state: present state: present
# Always refreshed: a run that wrote the source line but failed to fetch its lists heals here.
update_cache: true update_cache: true
register: __docker_packages register: __docker_packages
notify: Restart docker notify: Restart docker
+1
View File
@@ -159,6 +159,7 @@ system_baseline_extra_remove_packages: [telnet]
``` ```
- Each item is a Debian package name: lower-case letters, digits, `+`, `-` and `.`, two or more characters, starting with a letter or digit and not ending in `-` (apt reads a trailing minus as a removal). Anything else stops the run. Duplicates of the profile list are harmless. - Each item is a Debian package name: lower-case letters, digits, `+`, `-` and `.`, two or more characters, starting with a letter or digit and not ending in `-` (apt reads a trailing minus as a removal). Anything else stops the run. Duplicates of the profile list are harmless.
- The role does not refresh an APT cache younger than an hour, so a package from a source you add just before the role (`ansible.builtin.deb822_repository` does not refresh) needs your own cache refresh first.
- An extra counts wherever the role looks for a package in the list: an extra `tmux` enables the tmux snippet and an extra `unattended-upgrades` the unattended-upgrades tasks, as a profile package does. - An extra counts wherever the role looks for a package in the list: an extra `tmux` enables the tmux snippet and an extra `unattended-upgrades` the unattended-upgrades tasks, as a profile package does.
- A package that one input installs and another purges stops the run before any change: `system_baseline_extra_packages` against `system_baseline_remove_packages` or `system_baseline_extra_remove_packages`, and `system_baseline_extra_remove_packages` against `system_baseline_essential_packages`. The resolved lists are not checked against each other, so a consumer's own overlap there behaves as before. - A package that one input installs and another purges stops the run before any change: `system_baseline_extra_packages` against `system_baseline_remove_packages` or `system_baseline_extra_remove_packages`, and `system_baseline_extra_remove_packages` against `system_baseline_essential_packages`. The resolved lists are not checked against each other, so a consumer's own overlap there behaves as before.
+1
View File
@@ -4,6 +4,7 @@
name: "{{ __system_baseline_install_packages }}" name: "{{ __system_baseline_install_packages }}"
state: present state: present
update_cache: true update_cache: true
cache_valid_time: 3600
become: true become: true
- name: Gather installed packages - name: Gather installed packages
+2 -2
View File
@@ -29,8 +29,8 @@ else
fi fi
ansible --version ansible --version
molecule --version molecule --version
# The collection under test first; molecule does not install it again (prerun is off in # The collection under test first; molecule also installs it into each scenario's ANSIBLE_HOME,
# .config/molecule/config.yml). # which the run script keeps in the job tree.
export ANSIBLE_COLLECTIONS_PATH="$AC_ROOT:${extra_collections}/opt/collections" export ANSIBLE_COLLECTIONS_PATH="$AC_ROOT:${extra_collections}/opt/collections"
# Facts are not injected as variables (deprecated in ansible-core 2.22, removal scheduled for 2.24, see #364), so a # Facts are not injected as variables (deprecated in ansible-core 2.22, removal scheduled for 2.24, see #364), so a
# role that reads a bare `ansible_<fact>` fails its scenario here instead of in a consumer's inventory. # role that reads a bare `ansible_<fact>` fails its scenario here instead of in a consumer's inventory.
+1 -2
View File
@@ -1,8 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# The Molecule workflow's "Run the scenarios" step: `molecule test` for each scenario directory on # The Molecule workflow's "Run the scenarios" step: `molecule test` for each scenario directory on
# stdin, MOLECULE_LANES (default 4) at a time, each with its own log and ANSIBLE_HOME under # stdin, MOLECULE_LANES (default 4) at a time, each with its own log and ANSIBLE_HOME under
# <work-dir>/<n>/ (no collection is installed there: .config/molecule/config.yml sets prerun false). # <work-dir>/<n>/ (molecule reinstalls the collection there with --force). Exit 1 on a failure.
# Exit 1 on a failure.
# #
# scripts/run_molecule_scenarios.sh <work-dir> < scenario-dirs # scripts/run_molecule_scenarios.sh <work-dir> < scenario-dirs
set -euo pipefail set -euo pipefail