# YUM module Install loop too clever

**URL:** <https://forum.ansible.com/t/yum-module-install-loop-too-clever/20402>\
**Category:** Ansible Project\
**Created:** [February 1, 2016, 3:59pm UTC](https://forum.ansible.com/t/yum-module-install-loop-too-clever/20402 "2016-02-01T15:59:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arthur\_Francis](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Arthur\_Francis](https://forum.ansible.com/u/Arthur_Francis)\
**Post date:** [February 1, 2016, 3:59pm UTC](https://forum.ansible.com/t/yum-module-install-loop-too-clever/20402/1 "2016-02-01T15:59:35Z")

</div>

Does anybody know if it is possible to make the yum module a little bit dumber and stop it from merging packages in one request? I am trying to install

`open-vm-tools`

and

`open-vm-tools-deploypkg`

on a centos vm, playbook snippet below.

`

- name: Install Standard Packages  
yum: state=present name={{ item }}  
with\_items:
- perl
- wget
- net-tools
- open-vm-tools
- open-vm-tools-deploypkg  
`

This should in theory work, however the open-vm-tools-deploypkg doesn’t install until open-vm-tools is on the system. I have reviewed the stdout and it places them into one yum install request and in the correct order. but still complains about the pre-requisite. If I seperate the open-vm-tools into another task then it works fine. I know its a minor thing but I would like to cut down the number of tasks as much as possible and was wondering if there is anything that can be done to stop it merging the request.

Thanks in advance.

A

---

<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:** [February 1, 2016, 6:55pm UTC](https://forum.ansible.com/t/yum-module-install-loop-too-clever/20402/2 "2016-02-01T18:55:30Z")

</div>

in 2.0 you can set ANSIBLE\_SQUASH\_ACTIONS env var or squash\_actions in  
ansible.cfg to not include the yum module (default is "apt, dnf,  
package, pkgng, yum, zypper"). Just note that now you'll be running 1  
task per item vs all items in 1 shot and will be much slower.

---

<div class="post-metadata">

**Author:** ![Josh\_Smift1](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Josh\_Smift1](https://forum.ansible.com/u/Josh_Smift1)\
**Post date:** [February 1, 2016, 7:00pm UTC](https://forum.ansible.com/t/yum-module-install-loop-too-clever/20402/3 "2016-02-01T19:00:36Z")

</div>

If you know that you have one particular page that needs to go first, and  
you know what it is, you could just create a second task (to run first) to  
install that package, and then a second task to install all the rest, right?

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-Josh (jbs@care.com)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.

---

<div class="post-metadata">

**Author:** ![Arthur\_Francis](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Arthur\_Francis](https://forum.ansible.com/u/Arthur_Francis)\
**Post date:** [February 2, 2016, 3:32pm UTC](https://forum.ansible.com/t/yum-module-install-loop-too-clever/20402/4 "2016-02-02T15:32:46Z")

</div>

Thanks Josh, Thats how I overcame the problem, but I was wondering if there was another way in the interests of compactness and efficiency.

Thanks  
Arthur

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [February 2, 2016, 8:05pm UTC](https://forum.ansible.com/t/yum-module-install-loop-too-clever/20402/5 "2016-02-02T20:05:54Z")

</div>

You maybe able to combine this with real lists to keep efficiency  
(Note: I haven't tested this):

&nbsp;&nbsp;&nbsp;&nbsp;- name: Install Standard Packages  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;yum: state=present name={{ item }}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- ['perl', 'wget', 'net-tools', 'open-vm-tools']  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- ['open-vm-tools-deploypkg']

&nbsp;&nbsp;&nbsp;ANSIBLE\_SQUASH\_ACTIONS='apt' ansible-playbook test.yml

Also note, this probably means that there's a bug in the packaging of  
open-vm-tools-deploypkg. Might want to report that to the packagers.  
If I had to guess without actually looking at the package,  
open-vm-tools-deploypkg probably uses some program from open-vm-tools  
in its %post or %pre install scriptlets but doesn't specify that as a  
proper Requires. As an example, if open-vm-tools-deploypkg ran  
something in %post that came from open-vm-tools then the Requires in  
open-vm-tools-deploypkg would have to look like Requires(post):  
open-vm-tools

-Toshio

---

<div class="post-metadata">

**Author:** ![Arthur\_Francis](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Arthur\_Francis](https://forum.ansible.com/u/Arthur_Francis)\
**Post date:** [February 8, 2016, 9:11am UTC](https://forum.ansible.com/t/yum-module-install-loop-too-clever/20402/6 "2016-02-08T09:11:04Z")

</div>

Thats a great idea, thanks!! I will give it a try
