Repository navigation
Move site variables to group_vars/all/main.yml so Ansible loads them - #5
Merged
Merged
Conversation
When an inventory has both group_vars/all.yml and a group_vars/all/ directory, Ansible's vars loader matches the directory first and stops, so all.yml is silently ignored (DataLoader.find_vars_files breaks on the first match). The example inventory shipped exactly that layout, with all/ holding vault.yml.example, so every inventory created from it lost its callsign, grid, timezone, and other site values and fell back to role defaults. - Move inventory/example/group_vars/all.yml to group_vars/all/main.yml. - Point scripts/configure.py, init-local-inventory.sh, the variable reference generator, README, and docs at the new path. - Fail fast in site.yml, bootstrap.yml, and network.yml, and in configure.py validation, while the old file sits next to all/, so existing local inventories get told to move it instead of staying silently broken. - Have qa.py reject reintroducing the old example path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
inventory/example/group_vars/all.ymltoinventory/example/group_vars/all/main.yml, next tovault.yml.example.scripts/configure.py,scripts/init-local-inventory.sh,scripts/generate-variable-reference.py,README.md, and the docs (concepts,configuration,first-deployment,getting-started) at the new path. Also updates the pointer comment in the rootgroup_vars/all.yml.playbooks/site.yml,playbooks/bootstrap.yml, andplaybooks/network.yml. It stops the run whengroup_vars/all.ymlsits next to agroup_vars/all/directory and tells the operator to move the file.scripts/configure.pyvalidation reports the same error.scripts/qa.pyrejects reintroducing the old example path.docs/configuration.mdnote explaining the layout and a CHANGELOG entry with the one-line migration.Why
When an inventory has both
group_vars/all.ymland agroup_vars/all/directory, Ansible loads only the directory and silently ignores the file.DataLoader.find_vars_filestries the bare name before the.ymlextension and stops at the first match. I confirmed this in the ansible-core 2.21.4 source.The example inventory shipped exactly that layout. So every local inventory created from it, whether by
init-local-inventory.sh, the configurator, or a manual copy, has hadhamstack_callsign,hamstack_grid_locator,hamstack_timezone, and every other site value silently dropped, with roles falling back to their own defaults. Found while setting up a real local inventory:ansible <host> -m debug -a var=hamstack_callsignreported it undefined.Validation
python3 scripts/qa.py— passedyamllint .— every changed YAML file is clean. Locally, the full-repo run still reports.venv/contents until yamllint: skip .venv and .cache like ansible-lint does #3 merges; CI is unaffected.ansible-lint— exit 0 (existing warnings only)ansible-playbook --syntax-check(site.yml,bootstrap.yml,network.yml)Tested hardware/OS and commands used: Linux (WSL2) controller, ansible-core 2.21.4, against a copy of the example inventory with a local-connection host:
all.ymlnext toall/):ansible-playbook playbooks/site.yml --checkstops at the new pre-task with the move instruction.all/main.yml): the pre-task passes, andansible -m debug -a var=hamstack_site_nameresolves the site value, which was undefined before.python3 scripts/generate-variable-reference.py --check— current.py_compileon the changed Python scripts andbash -noninit-local-inventory.sh— clean.Release/user impact
Manual migration for existing local inventories:
Until they do that,
site.yml,bootstrap.yml, andnetwork.ymlstop with that instruction rather than running with missing site values. After moving the file, site values that were previously ignored will start applying. Reviewhamstack_callsign,hamstack_timezone, and the rest before the next run, because a deployment that has been running on role defaults may see real changes.The
playbooks/profiles/*playbooks have no pre-tasks today and don't get the guard. They do benefit from the corrected example layout.Documentation and secrets
docs/variables.mdis regenerated — no variable names changed; reference regenerated and--checkpasses🤖 Generated with Claude Code