My host file looks something like this:

[Group]
host.com

[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 ?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dfc4c5f0-14c5-460c-aa1a-ed046e1b498d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to