My host file looks something like this:
[Group]
[Group:vars]
vars="{{src}}/varsFile.yaml
And in my playbook:
---
- hosts: "{{remote_hosts}}"
vars_files:
- "{{vars}}"
gather_facts: yes
tasks:
......
Now when i run this with the command:
ansible-playbook -i host playbook.yaml -e src=/opt/config
The playbook run fails as some variable (defined in varsFile.yaml) is not found.
But when i use the command:
ansible-playbook -i host playbook.yaml -e src=/opt/config -e vars=/opt/config/varsFile.yaml
Everything runs perfectly fine.
How can i make sure that when i provide this "src" as extra var, it can be used in multiple locations in my playbooks and host variables ?