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
13.9k stars 3.4k forks source link

Change how multiple inventory sources are synced #3769

Open wenottingham opened 5 years ago

wenottingham commented 5 years ago
ISSUE TYPE
SUMMARY

Currently, if you have multiple inventory sources for an inventory, they are synced individually. This leads to:

We should move to not doing individual inventory source syncs. Instead, we should, when an inventory is synced, run a single ansible-inventory process passing all inventory sources.

Note: this will be a behavior change that will change how inventory is computed. It will also change the mechanism such that "overwrite" and "overwrite vars" should not be used for individual sources.

abedwardsw commented 5 years ago

hi @wenottingham , I just ran into https://github.com/ansible/awx/issues/1997 and was wondering if when this feature is implemented it may also delete the no longer used group_vars/all from the inventory if the overwrite flag is set? I found it quite confusing as I had deleted a variable from my group_vars/all which didn't propogate to the inventory. It would be nice to add that feature to this enhancement if possible.

wenottingham commented 5 years ago

Possibly doable with this, yes.

keilr commented 5 years ago

We also ran into the same problem while refactoring our inventory. It's very confusing and dangerous that deletion of variables in group_vars/all doesn't propagate to the inventory. I suggest to increase priority on this issue.

joshmullis commented 3 years ago

Echoing what @abedwardsw stated on overwriting the global vars. At the very least, there could either be:

planeturban commented 3 years ago

Adding to @joshmullis checkboxes (for inventory sourced from project)::

This would remove the workaround of having an dummy inventory file listing just the groups that should be extended by the projects groupvars:

[webservers]
[databases]
[jumphosts]

Come to think about it, in the dropdown: add the "just source grup_vars" so one doesn't have to use the workaround above at all.

And: adding a priority setting would be nice. So one still can have inventory source 3 overwriting the merged (-i s1 -i s2) sources with a lower priority.

lucab85 commented 3 years ago

+1

DE110283 commented 2 years ago

+1

db0 commented 2 years ago

I got a behaviour which seems relevant as well. I'm creating about 10 azurerm inventory sources in the same inventory with some conditional groups which will create me one group per OS type (windows/linux). In the windows one, I put the relevant winrm variables to allow the connections to windows host work from the same templates as linux. This inventory typically syncs on each job execution

Randomly, these variables are wiped. I don't know how or why exactly, as I haven't managed to replicate it. But I will notice it when my jobs against windows hosts start failing because they're trying to ssh to them.

I opened a case with RH which redirected me to this issue.