ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.11k stars 3.43k forks source link

group_vars and host_vars ignored when placed inside inventory folder (as per Ansible documentation) #15438

Open hagaram opened 3 months ago

hagaram commented 3 months ago

Please confirm the following

Bug Summary

When I create a job template, using some static inventory from repository (inventory --> add --> sync from source control), which is the same repository where also playbooks and group_vars/host_reside... the vars are ignored when the folders are placed inside invetory folder... unless I move them to playbooks folder.

I can't even, because my variables are encrypted with Ansible vault, but I'm unable to select vault secret for inventory sync job. (there asi already like a dozen issues reporting this, so I won't be creating new one for that).

How exactly does AWX work with variables/ Where does it read variables from ? I don't really need to import the variables to awx, as they are already in the repository.

AWX version

24.6.1

Select the relevant components

Installation method

kubernetes

Modifications

no

Ansible version

No response

Operating system

No response

Web browser

No response

Steps to reproduce

Run some playbook, with group_vars and host_vars being folders being inside the directory, where the static inventory is stored.

After moving the group_vars and host_vars to playbook directory, they are read properly - but this is something we don't want to do for various reasons.

Expected results

Ansible should read the variables.

Actual results

Ansible ignores the variables.

Additional information

No response

hagaram commented 2 months ago

Anyone?

robschm commented 1 month ago

I have exactly the same problem. It only works, when the variables are inside the playbooks directory.

This is my directory structure:

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

If I put my inventory file and group_vars on root level it does not work either.