# Problem with inventory variables after sync with git

**URL:** <https://forum.ansible.com/t/problem-with-inventory-variables-after-sync-with-git/3073>\
**Category:** Get Help\
**Tags:** gitlab, variables, awx\
**Created:** [December 27, 2023, 12:07pm UTC](https://forum.ansible.com/t/problem-with-inventory-variables-after-sync-with-git/3073 "2023-12-27T12:07:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dawid.grygrzc](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dawid.grygrzc](https://forum.ansible.com/u/dawid.grygrzc)\
**Post date:** [December 27, 2023, 12:07pm UTC](https://forum.ansible.com/t/problem-with-inventory-variables-after-sync-with-git/3073/1 "2023-12-27T12:07:34Z")

</div>

Hi all!  
I have a problem with variables in inventory.

I have a project called ‘test’ (gitlab). Option “Update Revision on Launch” has been filled up.

I have a source called ‘test-source’. Options “Overwrite|Overwrite variables|Update on launch” have been filled up.

When I am doing some changes in group variables everything is going well and smoothly. The problem is with variables for ‘all’.  
I am not able to sync it correctly. When I remove proper variables, after sync this one is still visible. When I change some value of a variable, the new value is visible correctly.

Any ideas on how to cope with that?

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [December 27, 2023, 3:48pm UTC](https://forum.ansible.com/t/problem-with-inventory-variables-after-sync-with-git/3073/2 "2023-12-27T15:48:41Z")

</div>

Hi, there is an open issue for this topic. Several workarounds have been offered, but none seem to be ideal yet.

> <https://github.com/ansible/awx/issues/11623>
>
> \### Please confirm the following
> 
> \- \[X\] I agree to follow this project's \[code… of conduct\](https://docs.ansible.com/ansible/latest/community/code\_of\_conduct.html).
> \- \[X\] I have checked the \[current issues\](https://github.com/ansible/awx/issues) for duplicates.
> \- \[X\] I understand that AWX is open source software provided for free and that I might not receive a timely response.
> 
> \### 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
> 
> \`\`\` 
> diff --git a/inventory/avv-prod/group\_vars/all.yaml b/inventory/avv-prod/group\_vars/all.yaml
> index af2262cf..2a7c90de 100644
> \--- a/inventory/avv-prod/group\_vars/all.yaml
> +++ b/inventory/avv-prod/group\_vars/all.yaml
> @@ -52,4 +52,3 @@ git\_dest: "{{ lookup('env', 'PWD') }}"
> grafana\_url: "https://grafana.host.zz"
> grafana\_user: "admin"
> grafana\_password: "123456"
> \-test\_var: test\_zzz
> \`\`\`
> 
> After project refresh (+inventory update on dependency): 
> 
> https://awx-test.host.zz/#/inventories/inventory/8/details
> Inventories -\> avv-prod -\> Variables 
> 
> \`\`\`
> \<skiped\>
> grafana\_url: "https://grafana.host.zz"
> grafana\_user: "admin"
> grafana\_password: "123456"
> test\_var: test\_zzz
> \`\`\`
> 
> 
> \### 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:
> \`\`\`
> Overwrite local groups and hosts from remote inventory source
> Overwrite local variables from remote inventory source
> Update on project update
> \`\`\`
> 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
> 
> \`\`\`
> (.local) \[d@z1 ansible-builder\]$ cat requirements.txt 
> urllib3
> boto3
> influxdb
> dnspython
> netaddr
> psutil
> bcrypt
> cryptography\>=3.0
> Jinja2==2.11.3
> jmespath==0.10.0
> paramiko
> pyasn1
> PyNaCl
> python-dateutil
> six
> supervisor
> virtualenv
> netaddr
> asn1crypto
> babel
> cffi
> idna
> markupsafe
> ply
> pycparser
> pytz
> pyyaml
> ara
> PyMySQL
> \`\`\`
> 
> \`\`\`
> (.local) \[domas@x1 ansible-builder\]$ cat requirements.yml 
> \---
> collections:
> - community.general
> - ansible.posix
> - ansible.utils
> - community.aws
> - community.crypto
> - community.grafana
> - community.mysql
> - community.zabbix
> - community.crypto
> \`\`\`

---

<div class="post-metadata">

**Author:** ![dawid.grygrzc](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dawid.grygrzc](https://forum.ansible.com/u/dawid.grygrzc)\
**Post date:** [December 28, 2023, 2:43pm UTC](https://forum.ansible.com/t/problem-with-inventory-variables-after-sync-with-git/3073/3 "2023-12-28T14:43:50Z")

</div>

> [@kurokobo](#):
>
> Hi, there is an open issue for this topic. Several workarounds have been offered, but none seem to be ideal yet.

Oooo, thanks!  
I will use the workaround with custom group called ‘global’.  
Strongly belive that that case will be solved soon.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [January 27, 2024, 2:44pm UTC](https://forum.ansible.com/t/problem-with-inventory-variables-after-sync-with-git/3073/4 "2024-01-27T14:44:45Z")

</div>

Closed on January 27, 2024, 2:44pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
