jackson
jackson

Reputation: 486

How to use group_vars or host_vars when playbooks are in a subdirectory in Ansible AWX

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

It only works, 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?

update: This is also mentioned here: https://github.com/ansible/awx/issues/15438

Upvotes: 0

Views: 133

Answers (1)

bbaassssiiee
bbaassssiiee

Reputation: 6802

AWX and AAP work fine when you split the inventory/inventories in separate git repositories, apart from your "project" which has the playbooks. On the command-line Ansible configuration file can be used to define roles_path and inventory. Implicitly collections/requirements.yml and roles/requirements.yml are used to pull in dependencies.

Upvotes: 0

Related Questions