Location of host and group configuration

Hi all,

I'm currently struggling with how to tell Ansible where it can find host_vars and group_vars folders. Is there an environmet
variable for it? Does it have to be inside the same folder as the playbook?

Regards,

  Uwe

It can be inside the same folder as the playbook.

root
– group_vars/all.yml
– host_vars/some_host.yml
– myPlaybook.yml

Yes, that I've alredy figured out. But what if I want to group my playbooks inside different folders but the group and host vars
should be the same? Is there an option to tell Ansible where to look for those folders?

I imagine a dir tree like:

.
├── group_vars
│ ├── group1.yaml
│ └── group2.yaml
├── host_vars
│ ├── host1.yaml
│ ├── host2.yaml
│ └── localhost.yaml
├── group1-playbooks
│ ├── 00-requirements.yaml
│ ├── 01-copy-static-files.yaml
│ └── 99-cleanup.yaml
├── group2-playbooks
│ ├── 00-requirements.yaml
│ ├── 01-copy-static-files.yaml
│ └── 99-cleanup.yaml
└── inventory

Regards,

  Uwe

I don't think that is possible. You need to have the group_vars and host_vars in the inventory directory or the playbook directory.
group_vars and host_vars in the playbook directory will overwrite those in the inventory directory if both exist.