I'm trying to use my first playbook with a galaxy role and while I can get the role to run, I can't seem to get it to find the group_vars I've defined.

The role is nickjj.mariadb (not that that probably matters) but in the docs its stated that group_vars should be relative to your inventory directory.

I've tried a couple of different things but so far no dice.

 ├── group.vars
 │   └── siteservers.yml
 ├── install_maria.yml
 ├── inventory
 │   └── hosts
 └── update-apt.yml

is what I have for the layout and I'm running the playbook with

ansible-playbook -i inventory/hosts -l siteservers install_maria.yml -K

It is finding the ip address of the server from the hosts file happily, but doesn't seem to pick up the variables from siteservers.yml.

Where should this be put? Am I close with the layout or is it all wrong?


2 Answers 2


Try setting the PLAYBOOK_VARS_ROOT parameter to the path of the playbook so Ansible can find the group_vars directory. Or set the value to bottom

This sets which playbook dirs will be used as a root to process vars plugins, which includes finding host_vars/group_vars The top option follows the traditional behaviour of using the top playbook in the chain to find the root directory. The bottom option follows the 2.4.0 behaviour of using the current playbook to find the root directory. The all option examines from the first parent to the current playbook.


You have a typo in your directory name: group.vars

This should have an underscore, not a full stop: group_vars

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.