# Problem with squashing complex arguments (#12976)

**URL:** <https://forum.ansible.com/t/problem-with-squashing-complex-arguments-12976/19659>\
**Category:** Ansible Developer\
**Created:** [October 30, 2015, 5:59pm UTC](https://forum.ansible.com/t/problem-with-squashing-complex-arguments-12976/19659 "2015-10-30T17:59:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lars\_Kellogg-Stedma1](https://avatars.discourse-cdn.com/v4/letter/l/ed655f/32.png) [@Lars\_Kellogg-Stedma1](https://forum.ansible.com/u/Lars_Kellogg-Stedma1)\
**Post date:** [October 30, 2015, 5:59pm UTC](https://forum.ansible.com/t/problem-with-squashing-complex-arguments-12976/19659/1 "2015-10-30T17:59:39Z")

</div>

I wanted to draw attention to this issue, filed earlier today by  
opoplwaski:

- [https://github.com/ansible/ansible/issues/12976](https://github.com/ansible/ansible/issues/12976)

It highlights several regressions between 1.9.x and 2.0.0, primarily  
concerning situations in which Ansible attempts to "squash" a list of  
arguments for performance reasons (e.g., for package managers). The  
TL;DR is that this works under 1.9.x...

&nbsp;&nbsp;&nbsp;&nbsp;- name: Install common packages  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dnf:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name: "{{item.name}}"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state: "{{item.state}}"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- { name: bash-completion, state: present }  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- { name: sssd, state: present }

...but fails under 2.0.0. There are additional failures, as well,  
related to when template expressions are evaluated (apparently earlier  
in 1.9.x and later in 2.0.0).

I'm wondering if it would make sense to (a) just remove the item  
squashing code, which seems pretty hacky at first glance, and (b)  
rewrite the packaging modules to accept a list of packages in  
addition to a single name. So the above would become something like:

&nbsp;&nbsp;&nbsp;&nbsp;- name: Install common packages  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dnf:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state: present  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- bash-completion  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- sssd

This gets you the performance advantage of batched package installs  
without the weird special-casing for these modules. I realize that  
this is not a perfect equivalent to the first example, because all  
pacakges get the same value for 'state', but I think that's a valid  
restriction and would ultimately make the underlying code much more  
maintainable.

---

<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:** [October 30, 2015, 6:21pm UTC](https://forum.ansible.com/t/problem-with-squashing-complex-arguments-12976/19659/2 "2015-10-30T18:21:05Z")

</div>

I had some related ideas:  
[https://github.com/ansible/ansible/issues/12086](https://github.com/ansible/ansible/issues/12086)

that would let you control the 'squash', which is not meant to work  
with diff values for other options.
