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.
tree
.
├── 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?
Try setting the
PLAYBOOK_VARS_ROOT
parameter to the path of the playbook so Ansible can find thegroup_vars
directory. Or set the value tobottom
You have a typo in your directory name:
group.vars
This should have an underscore, not a full stop:
group_vars