# group variables not changing

**URL:** <https://forum.ansible.com/t/group-variables-not-changing/13886>\
**Category:** Ansible Project\
**Created:** [November 12, 2013, 3:32am UTC](https://forum.ansible.com/t/group-variables-not-changing/13886 "2013-11-12T03:32:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xiaodong\_Xu](https://avatars.discourse-cdn.com/v4/letter/x/a87d85/32.png) [@Xiaodong\_Xu](https://forum.ansible.com/u/Xiaodong_Xu)\
**Post date:** [November 12, 2013, 3:32am UTC](https://forum.ansible.com/t/group-variables-not-changing/13886/1 "2013-11-12T03:32:45Z")

</div>

I use group variables encountered the following problems, can you help me? Thank you.

% cat group\_vars/bj

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [November 12, 2013, 3:48pm UTC](https://forum.ansible.com/t/group-variables-not-changing/13886/2 "2013-11-12T15:48:46Z")

</div>

It would be helpful if you could explain the problem in words some, in terms of what you saw vs what you expected to see.

There are no known issues with group variables so it’s just a matter of explaining behavior, but that would help. Thanks!

---

<div class="post-metadata">

**Author:** ![Scott\_Sturdivant](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@Scott\_Sturdivant](https://forum.ansible.com/u/Scott_Sturdivant)\
**Post date:** [November 12, 2013, 4:21pm UTC](https://forum.ansible.com/t/group-variables-not-changing/13886/3 "2013-11-12T16:21:05Z")

</div>

Ah, I’ve had this issue before too. From what I can tell, the same host (localhost) appears in two different groups, bj and sh. The same variable ‘gv’ is defined in both groups. One might expect that when targeting one particular group, that vars for the explicitly targeted group will “win” in the case of a conflict. Hence in this case, the ‘gv’ var will show ‘sh’ when targeting the ‘sh’ group, and ‘bj’ when targeting the ‘bj’ group. However what happens is that shows ‘bj’ in both cases.

In my case, I did a lot of re-organizing to start using roles, etc and in the process the problem went away. Perhaps someone else can provide a “you’re thinking about this wrong, try this instead” best practices recommendation!

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [November 12, 2013, 4:23pm UTC](https://forum.ansible.com/t/group-variables-not-changing/13886/4 "2013-11-12T16:23:20Z")

</div>

The last group loaded ‘wins’, there is nothing in ansible that checks the targeted group.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [November 12, 2013, 4:31pm UTC](https://forum.ansible.com/t/group-variables-not-changing/13886/5 "2013-11-12T16:31:02Z")

</div>

Ah, that.

What are the real world names and purposes of these groups? I can likely help with suggestions.

– Michael

---

<div class="post-metadata">

**Author:** ![Xiaodong\_Xu](https://avatars.discourse-cdn.com/v4/letter/x/a87d85/32.png) [@Xiaodong\_Xu](https://forum.ansible.com/u/Xiaodong_Xu)\
**Post date:** [November 13, 2013, 2:37am UTC](https://forum.ansible.com/t/group-variables-not-changing/13886/6 "2013-11-13T02:37:40Z")

</div>

I use a different host, now the problem has been resolved. Thanks.
