# Playbook using groups module and dictionary looping doesn't work

**URL:** <https://forum.ansible.com/t/playbook-using-groups-module-and-dictionary-looping-doesnt-work/16810>\
**Category:** Ansible Developer\
**Created:** [November 18, 2014, 1:03pm UTC](https://forum.ansible.com/t/playbook-using-groups-module-and-dictionary-looping-doesnt-work/16810 "2014-11-18T13:03:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Osielczak](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@Daniel\_Osielczak](https://forum.ansible.com/u/Daniel_Osielczak)\
**Post date:** [November 18, 2014, 1:03pm UTC](https://forum.ansible.com/t/playbook-using-groups-module-and-dictionary-looping-doesnt-work/16810/1 "2014-11-18T13:03:48Z")

</div>

Hi,

I have googled around and couldn’t find any info regarding this but I suspect there is something wrong with how the group module handles dictionaries.

I have a following entry for host in host\_vars directory:

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [November 20, 2014, 4:44pm UTC](https://forum.ansible.com/t/playbook-using-groups-module-and-dictionary-looping-doesnt-work/16810/2 "2014-11-20T16:44:40Z")

</div>

Hi Daniel, this appears to be an issue with an internal variable named groups, which contains the groups to which the current inventory host belongs. Using your example, if I change the variable name to “my\_groups”, everything works fine.

Thanks!

---

<div class="post-metadata">

**Author:** ![Daniel\_Osielczak](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@Daniel\_Osielczak](https://forum.ansible.com/u/Daniel_Osielczak)\
**Post date:** [November 21, 2014, 4:31pm UTC](https://forum.ansible.com/t/playbook-using-groups-module-and-dictionary-looping-doesnt-work/16810/3 "2014-11-21T16:31:30Z")

</div>

Hi James,

you are absolutely correct. I actually got the answer a few hours earlier from Toshio Kuratomi [tkuratomi@ansible.com](mailto:tkuratomi@ansible.com) but this is exactly the culprit.

Thanks again,  
Daniel

W dniu czwartek, 20 listopada 2014 17:44:42 UTC+1 użytkownik James Cammarata napisał:
