mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
add note regarding {host,group}_vars directory lookup semantics (#48066)
* add note regarding {host,group}_vars directory lookup semantics
While the 'ansible-playbook' command will look for {host,group}_vars in
both the playbook and inventory directories, the 'ansible' command
will only look in the inventory directory. This follows from a close
reading of the documentation but isn't explicit and leads to the
perhaps unexpected result that you can run both commands with the same
configuration in the same directory and get different results.
This commit adds a note to the documentation making the difference in
behavior explicit.
Closes #48065
* incorporates bcoca feedback
This commit is contained in:
committed by
Brian Coca
parent
d27d956d71
commit
220d224433
@@ -311,6 +311,10 @@ Tip: The ``group_vars/`` and ``host_vars/`` directories can exist in
|
||||
the playbook directory OR the inventory directory. If both paths exist, variables in the playbook
|
||||
directory will override variables set in the inventory directory.
|
||||
|
||||
Tip: The ``ansible-playbook`` command looks for playbooks in the current working directory by default. Other Ansible commands (for example, ``ansible``, ``ansible-console``, etc.) will only look for ``group_vars/`` and ``host_vars/`` in the
|
||||
inventory directory unless you provide the ``--playbook-dir`` option
|
||||
on the command line.
|
||||
|
||||
Tip: Keeping your inventory file and variables in a git repo (or other version control)
|
||||
is an excellent way to track changes to your inventory and host variables.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user