# Defining vars in a file and looping over them

**URL:** <https://forum.ansible.com/t/defining-vars-in-a-file-and-looping-over-them/20574>\
**Category:** Ansible Project\
**Created:** [February 14, 2016, 4:26pm UTC](https://forum.ansible.com/t/defining-vars-in-a-file-and-looping-over-them/20574 "2016-02-14T16:26:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wayne\_Pascoe](https://avatars.discourse-cdn.com/v4/letter/w/919ad9/32.png) [@Wayne\_Pascoe](https://forum.ansible.com/u/Wayne_Pascoe)\
**Post date:** [February 14, 2016, 4:26pm UTC](https://forum.ansible.com/t/defining-vars-in-a-file-and-looping-over-them/20574/1 "2016-02-14T16:26:38Z")

</div>

Hi all,

I’m trying to work with vars in a vars file inside a role, and I’m unable to make it work. I’m working from [http://docs.ansible.com/ansible/playbooks\_loops.html#standard-loops](http://docs.ansible.com/ansible/playbooks_loops.html#standard-loops). Any pointers on what I’m doing wrong would be much appreciated.

I’m using 2.1.0 from Git on Debian.

If I have the following task in my role, it works as expected:

`

---

<div class="post-metadata">

**Author:** ![Wayne\_Pascoe](https://avatars.discourse-cdn.com/v4/letter/w/919ad9/32.png) [@Wayne\_Pascoe](https://forum.ansible.com/u/Wayne_Pascoe)\
**Post date:** [February 14, 2016, 4:28pm UTC](https://forum.ansible.com/t/defining-vars-in-a-file-and-looping-over-them/20574/2 "2016-02-14T16:28:38Z")

</div>

Ah - that was simple… groups appears to be a reserved name. Changing to unixgroups works a treat.  
Sorry for the noise…
