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

Lazy loading of variables from Ansible's HostVars object #2

Open
wants to merge 4 commits into
base: ansible-api
Choose a base branch
from

Conversation

wbh1
Copy link

@wbh1 wbh1 commented May 17, 2022

This takes advantage of lazy loading host variables from inventory so that
only variables whose values are accessed by the template are actually loaded AND
they go through the Jinja templater when they are loaded.

Allows for correct representation of things like:

cat inventory/group_vars/mgmt_network.yml
ipv4:
- '{{ip_address_mgmt}}'

wbh1 added 4 commits May 17, 2022 17:00
/usr/bin/python is not guaranteed to exist. Should use /usr/bin/env to handle
virtualenvironments and python3-only installs.
This takes advantage of lazy loading host variables from inventory so that
only ones that need to be loaded by the template are actually loaded AND
they go through the Jinja templater when they are loaded.
Don't try to parse inventory cache files as if they were fact cache files.
If an inventory is specified, we should exclude discovered facts for hosts not in the inventory.

This helps with situations in which old facts are cached but the host(s) is no
longer in the inventory.
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.

1 participant