Install every required collection/role first, before anything else runs #10

Merged
sysadmin merged 2 commits from feature/install-collections-first into main 2026-10-06 19:01:36 +00:00
Contributor

New playbooks/install_collections.yml, imported between dynamic_inventory.yml and infra_work.yml, which drops its own former Play 2 entirely. Collects ansible_roles_list from every matched (planned-leaf) host -- available immediately after dynamic_inventory.yml, before Play 1 provisions anything -- instead of waiting for provision_tech_targets. Confirmed live that a discovered host's own provision_unit is always an unchanged copy of the planned leaf's list, so nothing is missed.

ansible_roles_list entries now declare source: git|localpath with path holding the actual location (one key for both kinds). Batched into one ansible-galaxy invocation per (source, collection-vs-role) kind.

Also fixes inventory_default_provision_roles' silvarion.provision.proxmox entry to carry its own source/path -- a bare entry here silently discarded whatever richer entry a leaf's own list declared for the same name, which only became a real problem once this became the sole installer.

Verified live against the real infrastructure/homelab repo (docker/core leaf). Confirmed the known silvarion.repos -> silvarion.databases transitive-dependency gap is unaffected either way (pre-existing, separate issue).

🤖 Generated with Claude Code

https://claude.ai/code/session_012icUrjv3vgHtovVpHUFjdp

New playbooks/install_collections.yml, imported between dynamic_inventory.yml and infra_work.yml, which drops its own former Play 2 entirely. Collects ansible_roles_list from every matched (planned-leaf) host -- available immediately after dynamic_inventory.yml, before Play 1 provisions anything -- instead of waiting for provision_tech_targets. Confirmed live that a discovered host's own provision_unit is always an unchanged copy of the planned leaf's list, so nothing is missed. ansible_roles_list entries now declare source: git|localpath with path holding the actual location (one key for both kinds). Batched into one ansible-galaxy invocation per (source, collection-vs-role) kind. Also fixes inventory_default_provision_roles' silvarion.provision.proxmox entry to carry its own source/path -- a bare entry here silently discarded whatever richer entry a leaf's own list declared for the same name, which only became a real problem once this became the sole installer. Verified live against the real infrastructure/homelab repo (docker/core leaf). Confirmed the known silvarion.repos -> silvarion.databases transitive-dependency gap is unaffected either way (pre-existing, separate issue). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_012icUrjv3vgHtovVpHUFjdp
Install every required collection/role first, before anything else runs
All checks were successful
Ansible Lint / ansible-lint (pull_request) Successful in 55s
7d97ade0b6
New playbooks/install_collections.yml, imported between dynamic_inventory.yml
and infra_work.yml, which drops its own former Play 2 ("install required
roles on the controller") entirely. Collects ansible_roles_list from every
matched host (the planned-leaf host, available immediately after
dynamic_inventory.yml -- confirmed against roles/proxmox/tasks/create/
lxc.yml's Step 6 that a discovered host's own provision_unit is always an
unchanged copy of the same list) instead of waiting for
provision_tech_targets, which only exists after Play 1 provisions -- by
which point Play 1 had already needed its own silvarion.provision.* roles
installed.

ansible_roles_list entries now declare source: git|localpath with path
holding the actual location (one key for both kinds -- ansible-galaxy
itself doesn't distinguish "URL" from "path" as separate concepts), not a
single source field holding the location string directly with type
sniffed by regex. Batched into one ansible-galaxy invocation per
(source, collection-vs-role) kind.

Also fixes inventory_default_provision_roles' silvarion.provision.proxmox
entry to carry its own source/path -- a bare entry here was always
silently preferred over whatever richer entry a leaf's own
ansible_roles_list_default declared for the same name, which only became
a real problem once this playbook became the sole installer with no
external self-install mechanism to fall back on.

Verified live against the real infrastructure/homelab repo (docker/core
leaf): correct install specs derived and batched, confirmed the
silvarion.provision.proxmox default-role fix actually restores its
source/path, and confirmed the known silvarion.repos -> silvarion.databases
transitive-dependency gap is unaffected either way (pre-existing,
orthogonal to this change).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012icUrjv3vgHtovVpHUFjdp
Add bootstrap_collection.yml as the true first step in main.yml
All checks were successful
Ansible Lint / ansible-lint (pull_request) Successful in 58s
ce29e84e13
install_collections.yml (added earlier in this same PR) can't actually
run before dynamic_inventory.yml -- it discovers what to install from
parsed inventory, which doesn't exist yet at that point. But
dynamic_inventory.yml's own first task is an FQCN reference into this
collection (include_role, silvarion.provision.inventory), which needs
the collection already resolvable on Ansible's collection search path --
true for an operator's own local dev setup, never true for a raw git
checkout invoked by file path (e.g. a CI/CD runner's "playbook filename"
field, with no FQCN resolution for the entry playbook at all).

This new playbook is the actual answer: ansible.builtin only, no
silvarion.provision.* role/plugin reference, installing just this
collection itself from its own canonical repo (same URL already
hardcoded in requirements.yml's self-install entry and
inventory_default_provision_roles). Runs first in main.yml, before
dynamic_inventory.yml. install_collections.yml keeps its position right
after dynamic_inventory.yml.

Verified live: ansible-playbook silvarion.provision.bootstrap_collection
runs clean on its own.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012icUrjv3vgHtovVpHUFjdp
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ansible-collections/silvarion.provision!10
No description provided.