I have a query regarding vars structure in Ansible.
Example:
-vars
-
sample.yml
-
tasks
-
main.yml
In task:
include_vars: sample.yml
- copy: src={{vars[inventory_hostname_short + ‘_instance’ }} dest={{some_path}}
or
- copy: src={{vars/sample.yml[inventory_hostname_short + ‘_instance’ }} dest={{some_path}}
The above copy command searching for main.yml in vars.
→ How should we consider taking sample.yml instead of vars ??