# Unexpected "Item is undefined"

**URL:** <https://forum.ansible.com/t/unexpected-item-is-undefined/17016>\
**Category:** Ansible Project\
**Created:** [December 10, 2014, 8:41pm UTC](https://forum.ansible.com/t/unexpected-item-is-undefined/17016 "2014-12-10T20:41:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Capi\_Etheriel](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@Capi\_Etheriel](https://forum.ansible.com/u/Capi_Etheriel)\
**Post date:** [December 10, 2014, 8:41pm UTC](https://forum.ansible.com/t/unexpected-item-is-undefined/17016/1 "2014-12-10T20:41:20Z")

</div>

Hi folks

I got kind of stuck with [https://gist.github.com/barraponto/a14c264a7755c8371ade](https://gist.github.com/barraponto/a14c264a7755c8371ade)

It’s in a role as you can see. I’ve gisted the only files I edited in it.  
The problem is it says item is not defined:

fatal: [localhost] =\> One or more undefined variables: ‘item’ is undefined

I’m running with -vvvv but I can’t get any better debug output, that is all ☹  
The thing is, I believe it _should_ work. I can’t see what’s the issue here…

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [December 10, 2014, 8:44pm UTC](https://forum.ansible.com/t/unexpected-item-is-undefined/17016/2 "2014-12-10T20:44:09Z")

</div>

> Hi folks
> 
> I got kind of stuck with  
> [https://gist.github.com/barraponto/a14c264a7755c8371ade](https://gist.github.com/barraponto/a14c264a7755c8371ade)

​kast line(13) in the task file, the indent of with\_items is wrong:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with\_items: aws\_vpc\_subnets

​

​Indent should be the same as the name: of the task

​

---

<div class="post-metadata">

**Author:** ![Capi\_Etheriel](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@Capi\_Etheriel](https://forum.ansible.com/u/Capi_Etheriel)\
**Post date:** [December 11, 2014, 2:19pm UTC](https://forum.ansible.com/t/unexpected-item-is-undefined/17016/3 "2014-12-11T14:19:22Z")

</div>

Thanks. I had misunderstood how with\_items were expanded.  
I have managed to wrap my head around it, results can be seen here: [https://github.com/barraponto/ansible-aws-vpc/blob/master/tasks/main.yml](https://github.com/barraponto/ansible-aws-vpc/blob/master/tasks/main.yml)
