project inventory source - overwrite variables

Hi there.

My use case is that I have satellite6 as my primary dynamic inventory source. When I have specific host_vars/group_vars variables that I want to set, my original thought was that I would combine the satellite dynamic inventory with a project/git based dynamic inventory (ie, two distinct sources on one inventory). This way I would have a versioned history of all the changes made to the host_vars/group_vars configuration through a git based project.

Unfortunately I have found that when using a “project” based dynamic inventory, the “overwrite variables” is hard coded to yes in the AWX UI. Therefore whenever the sync runs for the project/git inventory it overwrites all of the variable configuration that was brought in by the satellite dynamic inventory.

So wondering if anyone can provide some insights, specifically:

  1. Why is the project/git based inventory hard coded to “overwrite variables”? is there some type of limitation? It would be nice if it could “merge” similar to the other dynamic inventories. Should I create a feature request? I could assist with the implementation if there’s no reason not to do it.

  2. What are others that are using satellite as a dynamic inventory doing for custom host/group attributes. As of now, the only option would be to manually set them in awx, however I would really like to have version history of my host & group vars in the event something goes wrong.
    On the best practices page it does mention to use AWX to set host/group vars, but it also mentions use source control as another best practices, so it’s a little bit conflicting. I assume others can see the benefit of having your host/group vars source controlled?

Would appreciate any thoughts from others on this.

thanks.

There is a proposed patch to make it no longer hard coded.

https://github.com/ansible/awx/pull/2895

There was an issue with group_vars not loading in expected location, which was resolved on the Ansible core side by adding the --export flag to the command, and all those changes have been synced up by now… but potential versioning issues concerned us so we kept the guard rails for a few releases afterwards.

that’s great news Alan, thank you.

Wondering if you are aware of a workaround until the patch is merged. I am running in docker, so ideally if there was a workaround that did not involve building a custom image, that would be great.

I also added a comment to the underlying issue to hopefully move it along.
https://github.com/ansible/awx/issues/1271