I'm trying to create a playbook in which I have a single role though I 
expect this will expand with time. I want to load the variables in a file 
per play_host. I think I can include the variable file with the same name 
as the host with .yml or .yaml suffix in ./host_vars or 
./group_vars/<role_name> relative to the location of the inventory. However 
Ansible complains that these host variable files are not found unless they 
are in the same directory as the main playbook and inventory file.

The variable files are in ./host_vars. The main playbook & inventory are 
./site.yml & ./hosts, the role playbook is ./<role_name>/main.yml and is as 
below.

---
  - name: Include host variables
    include_vars: "{{ item }}.yml"
    with_items: "{{ play_hosts}}"

I suspect that the above play is not the best way of doing things as I see 
too many items in the task status (when I move the files to same directory 
as site.yml & inventory files).

Advice on the above sought :-)

-- 
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/b5192666-f11c-4ab2-8fa7-f34d1a20a4ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to