# Incongruous implementation of \`with\_items\` in package modules

**URL:** <https://forum.ansible.com/t/incongruous-implementation-of-with-items-in-package-modules/16896>\
**Category:** Ansible Developer\
**Created:** [November 26, 2014, 4:56pm UTC](https://forum.ansible.com/t/incongruous-implementation-of-with-items-in-package-modules/16896 "2014-11-26T16:56:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Devin\_Christensen](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@Devin\_Christensen](https://forum.ansible.com/u/Devin_Christensen)\
**Post date:** [November 26, 2014, 4:56pm UTC](https://forum.ansible.com/t/incongruous-implementation-of-with-items-in-package-modules/16896/1 "2014-11-26T16:56:55Z")

</div>

Consider the following use case for managing modules in an apache role:

Assume apache\_install\_modules is a list containing the items: module1, module2, and module3

> 

> - name: install modules  
> apt: name=libapache2-mod-{{ item }} state=present  
> with\_items: apache\_install\_modules
> - name: enable modules  
> apache2\_module: name={{ item }} state=present  
> with\_items: apache\_install\_modules

So far as I have read the Ansible documentation, the above should work; however, special handling for the apt (and other package modules) does a unique compilation step causing the apt task above to be interpreted as:

> - name: install modules  
> apt: name=libapache2-mod-module1,module2,module3 state=present

This is contrary to the intent of the user and contrary to the documented behavior of with\_items. To me, this seems really bad.

---

<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 26, 2014, 7:44pm UTC](https://forum.ansible.com/t/incongruous-implementation-of-with-items-in-package-modules/16896/2 "2014-11-26T19:44:28Z")

</div>

It’s really really really good, because you install everything in a single package transaction, saving lots of time.  
This comes up only sporadically.

Now, extra processing could be done to decide that the templating is weird, and to fix that argument _yes_. That would be nice.

Something you might like to work on, perhaps?
