# Looking up vars from files

**URL:** <https://forum.ansible.com/t/looking-up-vars-from-files/17871>\
**Category:** Ansible Project\
**Created:** [March 30, 2015, 11:58am UTC](https://forum.ansible.com/t/looking-up-vars-from-files/17871 "2015-03-30T11:58:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neil\_Saunders](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@Neil\_Saunders](https://forum.ansible.com/u/Neil_Saunders)\
**Post date:** [March 30, 2015, 11:58am UTC](https://forum.ansible.com/t/looking-up-vars-from-files/17871/1 "2015-03-30T11:58:05Z")

</div>

Hi All -

I’m trying iterate over a list of dicts stored in an external file.

My variables file (vpc.yml) is as follows:

`

---

<div class="post-metadata">

**Author:** ![Neil\_Saunders](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@Neil\_Saunders](https://forum.ansible.com/u/Neil_Saunders)\
**Post date:** [March 30, 2015, 12:24pm UTC](https://forum.ansible.com/t/looking-up-vars-from-files/17871/2 "2015-03-30T12:24:10Z")

</div>

Ok - It appears to be an issue with the indentation level of with\_items - I’ve dropped if back a level but an now receiving:

`

TASK: [Create ASG for each zone] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [127.0.0.1] =\> with\_items expects a list or a set

FATAL: all hosts have already failed – aborting

`

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 30, 2015, 12:33pm UTC](https://forum.ansible.com/t/looking-up-vars-from-files/17871/3 "2015-03-30T12:33:06Z")

</div>

how does region tie to eu-west-1?

---

<div class="post-metadata">

**Author:** ![Neil\_Saunders](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@Neil\_Saunders](https://forum.ansible.com/u/Neil_Saunders)\
**Post date:** [March 30, 2015, 2:10pm UTC](https://forum.ansible.com/t/looking-up-vars-from-files/17871/4 "2015-03-30T14:10:17Z")

</div>

Hi Brian - eu-west-1 _is_ the region.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 30, 2015, 2:13pm UTC](https://forum.ansible.com/t/looking-up-vars-from-files/17871/5 "2015-03-30T14:13:48Z")

</div>

still, how does that become?

with\_items: {{ region[environment] }}

also note that - is not a good character for variable names
