Open kzinas-adv opened 2 years ago
Same issue and with awx 17.1
Also reported in https://github.com/ansible/awx/issues/1997
i can see the same issue in AWX 20.1.0 . any plan for fixing it?
A customer has also reported regarding this issue. I understand the comment in #1997 though, we should provide a workaround or an option to remove the variables.
https://github.com/ansible/awx/issues/1997#issuecomment-398462633
You can purge inventory/myinv/group_vars/all.yaml data through AWX API:
PUT https://{{ awx_server }}/api/v2/inventories/{{ awx_inventory_group_id }}/variable_data/
And later run update that inventory, this will recreate inventory/myinv/group_vars/all.yaml
All this can be included in one workflow template.
At the very least a toggle would be nice, (perhaps per-inventory source) to allow for group_vars/all vars to be fully reloaded or something.
I just fell over this in AWX 22.1.0 and can't believe this is not yet solved in a better way.
The API workaround does not really help as the automated inventory sync happens before the actual workflow. If you remove the vars within that, you don't have any vars.
The easiest workaround for local roles seems to be to update conditions from when: <var> is defined
to when: <var> is defined and <var> != ""
in combination with <var>: ""
in group_vars
.
I've also been encountering this recently and it repeatedly trips Ansible users up in my organization. The only workaround we've found is to stop the usage of all.vars
in our inventories and instead create a new custom group, we call it global
, that every host gets added to. We lose some control over variable precedence since the all
group gets treated specially in that regard.
It would be nice to have the ability to set a toggle on the whole inventory that all.vars
should get wiped on a full sync.
The merged issue above, #13731, does not seem to address this since we are not using constructed inventories.
Edit: If there's another way we should be leveraging the existing functionality so that this isn't an issue, I'd be willing to explore it.
This is an issue for us too.
Big issue.
(using a dedicated group is not a workaround because of ansible's variable precedence, the group "all" has an important purpose)
Still exists in 23.1.0
The API workaround does not really help as the automated inventory sync happens before the actual workflow. If you remove the vars within that, you don't have any vars.
It works, we are using it for years, you just add additional task before your playbook run in workflow to resync inventory which you have purged.
Please confirm the following
Summary
Using sourced from project inventory update group_vars/all.yaml variables are not deleted After removing variable in git repo group_vars/all.yaml , it stays in awx default groups vars although it is gone. Change value of variable - OK Specific groups variables are not effected by this Specific host vars are not effected by this.
Inventory has these "Enabled Options": Overwrite local groups and hosts from remote inventory source Overwrite local variables from remote inventory source Update on project update
After project refresh (+inventory update on dependency):
https://awx-test.host.zz/#/inventories/inventory/8/details Inventories -> avv-prod -> Variables
AWX version
19.5.1
Installation method
kubernetes
Modifications
yes
Ansible version
2.12.1
Operating system
Debian 10.11
Web browser
No response
Steps to reproduce
Install awx 19.5.1 using operator latest on Kubernetes Create inventory which is sourced from project using options:
Add variable to inventory git repo group_vars/all.yaml Commit git, push git, update project on awx. Check your variable in awx inventory group all. Delete it in git Commit git, push git, update project on awx. Check your variable in awx inventory group all.
Expected results
It should be gone.
Actual results
It still exists.
Additional information
Custom-ee