AWX - How to use group_vars and host_vars when playbooks are in a subdirectory?

I need help configuring group_vars and host_vars in Ansible AWX when playbooks are in a subdirectory and not in the root directory.

Here is my directory structure:

inventory/
  group_vars/
    all/
       all.yml
  inventory
playbooks/
  test_group_vars.yml
ansible.cfg

On CLI everything works as expected, in AWX I get this error:

“my_group_var”: “VARIABLE IS NOT DEFINED!”

It only works in AWX, if I put my group_vars under the playbooks dir. AWX does not find the variables either in group_vars or inventory/group_vars.

I have seen multiple “best practice” project structures with group_vars inside an inventory subdir. Is it possible to put group_vars/host_vars outside of my playbook folder for AWX?

Do I need to set playbook_dir or playbook_vars_root?

Welcome to the forum, @actionjackson !

Please accept my sincere apology if this response comes across as somewhat blunt or even harsh, especially as this is in response to your first post. We’ve got a very supportive community growing here, and we all wish you and each other great success in our Ansible journey. That said, if you were hiking and saw someone you just met about to step into a pit or off a ledge, how would you balance shouting vs. politeness? That’s my dilemma. So I write:

Then some setting is different on the CLI. Run
ansible-config dump --only-changed
to see how your config differs from standard, and [if you insist on pursuing this ill-advised scheme] see if you can replicate that config in AWS AWX.

There are many threads on various discussion platforms where people try to put playbooks in places other than the top level of their Ansible projects. There’s a theme here along the lines of, “Dr., it hurts when I do this …”