# Problem going from 0.9 to 1.1 - with\_items: \<complex-list\> attached to include

**URL:** <https://forum.ansible.com/t/problem-going-from-0-9-to-1-1-with-items-complex-list-attached-to-include/12680>\
**Category:** Ansible Project\
**Created:** [April 13, 2013, 4:50pm UTC](https://forum.ansible.com/t/problem-going-from-0-9-to-1-1-with-items-complex-list-attached-to-include/12680 "2013-04-13T16:50:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asad\_Khan](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Asad\_Khan](https://forum.ansible.com/u/Asad_Khan)\
**Post date:** [April 13, 2013, 4:50pm UTC](https://forum.ansible.com/t/problem-going-from-0-9-to-1-1-with-items-complex-list-attached-to-include/12680/1 "2013-04-13T16:50:07Z")

</div>

The following works with 0.9 and earlier, but fails with 1.1 and trunk:

test11.yml:

hosts: somehosts  
user: ansible  
sudo: yes  
vars:  
component: { ‘name’ : ‘tomcat6’ , ‘version’ : ‘6.0.24-48.el6\_3’ }

tasks:

- include: tasks/task11.yml apps=$item  
with\_items: [[$component]]

task11.yml:

---

<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:** [April 13, 2013, 8:14pm UTC](https://forum.ansible.com/t/problem-going-from-0-9-to-1-1-with-items-complex-list-attached-to-include/12680/2 "2013-04-13T20:14:35Z")

</div>

Looks like you are sending a list of lists when you should be sending a single list.

I believe we fixed a glitch where it would auto-flatten before, because it may be useful to preserve exactly what you requested.

In either way, it’s not really documented that lists of lists should magically flatten, so I think it working as advertised is acceptable.

You can fix this problem by changing [[$foo]] to [$foo]

---

<div class="post-metadata">

**Author:** ![Asad\_Khan](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Asad\_Khan](https://forum.ansible.com/u/Asad_Khan)\
**Post date:** [April 13, 2013, 10:24pm UTC](https://forum.ansible.com/t/problem-going-from-0-9-to-1-1-with-items-complex-list-attached-to-include/12680/3 "2013-04-13T22:24:09Z")

</div>

No.  
I condensed this to illustrate the problem, I know I can pass in a list, that’s obvious, but that doesn’t represent our application structure.  
Nowhere is it documented that a list of lists _won’t_ flatten in this manner. Versions 0.8 through 1.0 flattened just fine in this manner while we were building the guts of our infrastructure.  
This is a critical blocker for us; our base structure is 2-level. We don’t have a workaround.

---

<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:** [April 14, 2013, 1:08am UTC](https://forum.ansible.com/t/problem-going-from-0-9-to-1-1-with-items-complex-list-attached-to-include/12680/4 "2013-04-14T01:08:55Z")

</div>

Nor was it ever documented that they _did_ flatten in this matter.

It seems like you were relying on a bug to me, for quite the opposite I say should be true, that you could pass lists of lists to with\_items and expect the structure to be preserved. I know lots of content that would do that and index $item.0 and item.1, and it would be wrong to break those people because you were using an undocumented feature. Sorry.

You can definitely write your own “with\_flattened” should you not wish to change whatever you are doing, using the 0.9 with\_items as a guide.

---

<div class="post-metadata">

**Author:** ![Asad\_Khan](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Asad\_Khan](https://forum.ansible.com/u/Asad_Khan)\
**Post date:** [April 16, 2013, 6:59pm UTC](https://forum.ansible.com/t/problem-going-from-0-9-to-1-1-with-items-complex-list-attached-to-include/12680/5 "2013-04-16T18:59:45Z")

</div>

I spent a couple of days and reworked this by transforming the problematic representation via jinja2 and python-land.  
(This is an example of my observations in other posts on needing to go outside Ansible whenever one needs to do progressive logic)  
The with\_flattened path may make sense technically, but I chose not to go down that route because that will open us up to just a different mode of future incompatibility - well unless it can be done on top of an existing, maintained API.

Now that I’m through the worst of this, I will respond to some of your other comments in more detail later.

---

<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:** [April 16, 2013, 7:18pm UTC](https://forum.ansible.com/t/problem-going-from-0-9-to-1-1-with-items-complex-list-attached-to-include/12680/6 "2013-04-16T19:18:45Z")

</div>

The filter plugins are a maintained API.

Please don’t imply they are not.

---

<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:** [April 16, 2013, 7:19pm UTC](https://forum.ansible.com/t/problem-going-from-0-9-to-1-1-with-items-complex-list-attached-to-include/12680/7 "2013-04-16T19:19:24Z")

</div>

Correction, “lookup plugins”.

---

<div class="post-metadata">

**Author:** ![Asad\_Khan](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Asad\_Khan](https://forum.ansible.com/u/Asad_Khan)\
**Post date:** [April 17, 2013, 6:31pm UTC](https://forum.ansible.com/t/problem-going-from-0-9-to-1-1-with-items-complex-list-attached-to-include/12680/8 "2013-04-17T18:31:36Z")

</div>

Then this is a valid path, good to know. No implication was intended, didn’t mean for it to come across that way.
