fix: Allow specifying OS vars from playbook_dir#330
Merged
mattwillsher merged 1 commit intowillshersystems:mainfrom Oct 8, 2025
Merged
fix: Allow specifying OS vars from playbook_dir#330mattwillsher merged 1 commit intowillshersystems:mainfrom
mattwillsher merged 1 commit intowillshersystems:mainfrom
Conversation
Previously, the "first_found" lookup would always find the
role_path/vars/main.yml file before any playbook_dir/vars/... file, so
it was impossible to set variables from the second directory.
This change:
+ Removes main.yml from the lookup file names so that the automatically
loaded role_path/vars/main.yml file can never stop another file from
being loaded
+ Replaces the inline lookup('first_found') call with a with_found_first
block so that the task won't fail if there is no additional vars file.
Member
|
Thanks @lkirkwood |
Contributor
Author
Thank you for a great role! |
|
I think this actually fixes an issue with OpenBSD in 0.28.0 which has been broken since 065812b, OpenBSD does not have a 'distribution_major_version' . I was going to PR it, until I found that this PR, the issue is gone. This was my change: |
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.
Enhancement: Previously, the "first_found" lookup would always find the
role_path/vars/main.ymlfile before anyplaybook_dir/vars/...file, so it was impossible to set variables from the second directory.This change:
main.ymlfrom the lookup file names so that the automatically loadedrole_path/vars/main.ymlfile can never stop another file from being loadedlookup('first_found')call with awith_found_firstblock so that the task won't fail if there is no additional vars file.Result: The behaviour of the role should be identical, except that it is now possible to use the
{{ playbook_dir }}/vars/...files that the role clearly intends to support.