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

Doc interplay between host_vars and group_vars dirs and inventory dirs #2386

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from

Conversation

kpinc
Copy link

@kpinc kpinc commented Jan 31, 2025

This is by observation of behavior, not by examination of code.

@ansible-documentation-bot ansible-documentation-bot bot added the new_contributor This PR is the first contribution by a new community member. label Jan 31, 2025
@ansible-documentation-bot
Copy link
Contributor

Thanks for your Ansible docs contribution! We talk about Ansible documentation on Matrix at #docs:ansible.im if you ever want to join us and chat about the docs! We meet on Matrix every Tuesday. See the Ansible calendar for meeting details. We welcome additions to our weekly agenda items too. You can add the dawgs-meeting tag to a forum topic to bring it up at the next meeting.

@oraNod oraNod requested a review from bcoca February 12, 2025 17:27
inventory directory, but sub-directories are not searched for
``host_vars`` or ``group_vars`` :ref:`directories
<splitting_out_vars>`. Sub-directories with these names are ignored.

Copy link
Member

@bcoca bcoca Feb 12, 2025

Choose a reason for hiding this comment

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

This is partially incorrect and due to not distinguishing what inventory sources are from what vars plugins provide.

All vars plugins (host_group_vars vars plugin governs the inclusion of host_vars/group_vars dirs) use the 'inventory source' as a base, when that is a directory the multiple files/subdirs do not count as independent inventory sources, just the original directory does.

Those directories (and vars_plugins and others from configuration INVENTORY_IGNORE_PATTERNS and INVENTORY_IGNORE_EXTS) are ignored if present, if not they would not have the same function you seem to expect. They would be processed at as part of an inventory source and they are probed as containing inventory files, but not vars files, which would end up either with warnings, errors or worse, creating unexpected hosts and groups depending on enabled inventory plugins.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your review. I've pushed a patch in response.

The new docs do not include mention of INVENTORY_IGNORE_PATTERS, etc. That seems overkill here.

Copy link
Author

Choose a reason for hiding this comment

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

I added links to the ignore config settings, just to be through. Hopefully this is not confusing.

Copy link
Member

Choose a reason for hiding this comment

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

I found so many things that needed updating in this page that i ended up creating my own PR #2416

@kpinc
Copy link
Author

kpinc commented Feb 17, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new_contributor This PR is the first contribution by a new community member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants