Host_vars not discovered

Hi I’ve followed Sample Ansible setup — Ansible Community Documentation and sometimes the host_vars directories are not discovered. How do I debug this, and does this layout work?

Yes.

By providing us with the reproducible example of what does not work :slightly_smiling_face:.

The documentation is kind of ambiguous about how to actually use that layout. I’m guessing it doesn’t work because you’ve configured the inventory source as inventories/. Try ansible-inventory -i inventories/production --list or ansible-inventory -i inventories/production/hosts - if the layout is the same as the example you should see any host_vars loaded from the production subdirectory. The host_group_vars plugin loads host_vars relative to inventory sources (for example, whatever you pass to -i, not to be confused with nested inventory files when the inventory source is a directory).

In case it’s helpful, I have an example of a custom vars plugin that loads vars relative to inventory files regardless of how the inventory sources are specified here.