# Include + with\_items AGAIN.

**URL:** <https://forum.ansible.com/t/include-with-items-again/16687>\
**Category:** Ansible Project\
**Created:** [November 4, 2014, 2:14pm UTC](https://forum.ansible.com/t/include-with-items-again/16687 "2014-11-04T14:14:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akos\_Vandra](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Akos\_Vandra](https://forum.ansible.com/u/Akos_Vandra)\
**Post date:** [November 4, 2014, 2:14pm UTC](https://forum.ansible.com/t/include-with-items-again/16687/1 "2014-11-04T14:14:40Z")

</div>

Hello,

I know, I know… It’s getting boring, but… I keep bumping into this a LOT.

I would like to bring back include + with\_items again.

Consider having:

- one nginx role
- a few other roles, let’s say it’s a wordpress role for now.

I’d like the nginx role to create a few sites that are given to it with its parameters by default, but I would like the wordpress role to be able to create other nginx sites for its own use.

What I am doing right now is that I have a tasks file in the nginx role that will take in a template parameter and a site name, and it will create that site, and enable it by symlinking into sites-enabled.

BUT!  
In the nginx role I cannot use this tasks file, since I would have to do an include + with\_items, so I had to duplicate that functionality, and assign with\_items to each and every one of the tasks described within.

What I would like to do is:

having a var like  
sites:

- name: site1  
someparameter: 42
- name: site2  
someparameter: 4242

To be able to call

- include: create\_site  
with\_items: sites

That would be the same as

- include: create\_site name=site1 someparameter=42

- include: create\_site name=site2 someparameter=4242

I know there are some problems with this, and it was deprecated due to confusion about how it worked.  
Maybe it should be brought back under another name? Maybe there is another solution for problems like this?

What is the ansible way of doing things such as this one?

Thanks,  
Akos

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [November 4, 2014, 2:36pm UTC](https://forum.ansible.com/t/include-with-items-again/16687/2 "2014-11-04T14:36:00Z")

</div>

The ‘v2/’ tree refactoring may possibly allow this.

Please be patient.
