Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ansible_facts instead of global scoped variables #226

Merged
merged 2 commits into from
Jul 19, 2022

Conversation

evrardjp
Copy link
Owner

No description provided.

evrardjp added 2 commits July 19, 2022 14:29
Without this patch, the include_vars is relying on the full hostvars
which can slow down the role execution.

Instead, load the right (recommended) variables.

At the same time, the use a first_found lookup instead of a
with_first_found loop allows the 'paths' parameter to be used.

This ensures that only vars from the role are included, and not vars
from a parent calling role. This can happen when a parent role has
a higher priority vars file available for inclusion than the role
it calls.
With previous patch, the ansible_facts were only used for the
include_vars.

This is a problem, as we don't get the full benefit of moving
towards ansible_facts.

This should fix it by ensuring the role is using ansible_facts
everywhere necessary.
@evrardjp evrardjp force-pushed the update_include_vars_to_recent_practices branch from 3392451 to 95a8ea4 Compare July 19, 2022 12:29
@evrardjp evrardjp merged commit 3e2d744 into master Jul 19, 2022
@evrardjp evrardjp deleted the update_include_vars_to_recent_practices branch July 19, 2022 12:47
Copy link
Contributor

@noonedeadpunk noonedeadpunk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants