awx icon indicating copy to clipboard operation
awx copied to clipboard

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

Open hagaram opened this issue 1 year ago • 3 comments

Please confirm the following

  • [X] I agree to follow this project's code of conduct.
  • [X] I have checked the current issues for duplicates.
  • [X] I understand that AWX is open source software provided for free and that I might not receive a timely response.
  • [X] I am NOT reporting a (potential) security vulnerability. (These should be emailed to [email protected] instead.)

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

  • [ ] UI
  • [ ] UI (tech preview)
  • [ ] API
  • [ ] Docs
  • [ ] Collection
  • [X] CLI
  • [X] Other

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 avatar Aug 12 '24 09:08 hagaram

Anyone?

hagaram avatar Sep 26 '24 09:09 hagaram

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.

robschm avatar Oct 16 '24 13:10 robschm