# \[Pull request\] rpm module

**URL:** <https://forum.ansible.com/t/pull-request-rpm-module/13356>\
**Category:** Ansible Project\
**Created:** [August 24, 2013, 11:52am UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356 "2013-08-24T11:52:16Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hiroaki\_Nakamura](https://avatars.discourse-cdn.com/v4/letter/h/e480ec/32.png) [@Hiroaki\_Nakamura](https://forum.ansible.com/u/Hiroaki_Nakamura)\
**Post date:** [August 24, 2013, 11:52am UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/1 "2013-08-24T11:52:16Z")

</div>

Hi, I created the rpm module for ansible and sent a pull request at github.

[https://github.com/ansible/ansible/pull/3938](https://github.com/ansible/ansible/pull/3938)

The use cases for the rpm module are:

- install a rpm to add a yum repository
- install a rpm built with rpm-build

Will you take a look?  
Thanks!

Hiroaki

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [August 24, 2013, 1:53pm UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/2 "2013-08-24T13:53:24Z")

</div>

The yum module can already take URLs for the package name (I’ve tested it with the EPEL RPM), I haven’t tried it with a local path but as mdehaan noted on the PR we would rather have the yum module extended rather than add another module that covers most of the same ground.

---

<div class="post-metadata">

**Author:** ![James\_Martin2](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@James\_Martin2](https://forum.ansible.com/u/James_Martin2)\
**Post date:** [August 24, 2013, 2:00pm UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/3 "2013-08-24T14:00:29Z")

</div>

The yum module does work with local rpms.

- James

---

<div class="post-metadata">

**Author:** ![Hiroaki\_Nakamura](https://avatars.discourse-cdn.com/v4/letter/h/e480ec/32.png) [@Hiroaki\_Nakamura](https://forum.ansible.com/u/Hiroaki_Nakamura)\
**Post date:** [August 24, 2013, 2:21pm UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/4 "2013-08-24T14:21:48Z")

</div>

Hi, James

Thanks for trying it out.

I tried it myself too and I confirmed I can pass a url or a local file path to a rpm file to the name parameter of the yum module.

I think the yum module document should be updated that the name parameter can accept a url or a local file path to a rpm file.  
What do you think?

---

<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:** [August 24, 2013, 4:58pm UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/5 "2013-08-24T16:58:48Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![Mark\_Phillips](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Mark\_Phillips](https://forum.ansible.com/u/Mark_Phillips)\
**Post date:** [September 10, 2013, 3:46pm UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/6 "2013-09-10T15:46:00Z")

</div>

> The yum module does work with local rpms.

Hmm, I’ve just had problems with that - XenServer 6.2, trying to install an RPM from a local file (as 'copy’ed over to the system). Didn’t want to play ball.

What version(s) of yum have you tested this with?

I’ve resorted to a command.

Cheers,

–Mark

---

<div class="post-metadata">

**Author:** ![Nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Nick](https://forum.ansible.com/u/Nick)\
**Post date:** [September 11, 2013, 3:40pm UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/7 "2013-09-11T15:40:00Z")

</div>

On this topic, I’ve also just now had problems (using a very recent version of devel), which I suspect is the yum module trying to optimise things. The rpms have been downloaded to the target machine using a previous task, and there is a var ‘3rdparty\_prereqs’ containing a list of rpm filenames (register:ed via another shell command). This definition amounts to: The failing task looks like this: It fails like this: It seems to be squashing the with\_items into one run, passing a comma-delimited list of the filenames to yum as the item to install, losing the necessary paths. Converting the task to a debug shows two correctly constructed paths printed. Is there a way of supplying a path (or paths) to the yum module in cases like this? Also, how does apt handle this sort of thing? Thanks N

---

<div class="post-metadata">

**Author:** ![Hiroaki\_Nakamura](https://avatars.discourse-cdn.com/v4/letter/h/e480ec/32.png) [@Hiroaki\_Nakamura](https://forum.ansible.com/u/Hiroaki_Nakamura)\
**Post date:** [September 13, 2013, 2:14am UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/8 "2013-09-13T02:14:24Z")

</div>

`Hi Nick,`

I had the same problem at past. A workaround I used was:

`

3rdparty\_prereqs: [` `‘`{{download_dir}}/rpms/apples-1.0.el6.i686.rpm`’,` `‘`{{download_dir}}/rpms/oranges-1.0.el6.i686.rpm`’]`

`- name: install 3rd party prerequisites`  
`action: yum name="{{item}}"'`  
`with_items: 3rdparty_prereqs`

`But with ansible at github, your example should work.`  
`Here is my playbook actually works.`

```auto
``
```

---

<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:** [September 13, 2013, 2:24am UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/9 "2013-09-13T02:24:49Z")

</div>

You should only pass in “item” as the parameter in this case.

It’s actually not the yum module per se, but something higher up in with\_items to group things into one transaction.

You can solve this by having the paths in the collection.

---

<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:** [September 13, 2013, 2:25am UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/10 "2013-09-13T02:25:11Z")

</div>

Yep, exactly!

---

<div class="post-metadata">

**Author:** ![Hiroaki\_Nakamura](https://avatars.discourse-cdn.com/v4/letter/h/e480ec/32.png) [@Hiroaki\_Nakamura](https://forum.ansible.com/u/Hiroaki_Nakamura)\
**Post date:** [September 13, 2013, 2:29am UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/11 "2013-09-13T02:29:54Z")

</div>

Hi,

By looking a log with -vvv option with running my example,  
I found yum are executed separetely for each rpm.

So it seems to be treated differently from your example.

I found this code does joining strings with comma if items is a list of strings.  
[https://github.com/ansible/ansible/blob/6e9fa5019f3d43500d6ad65bccf4291ffc550320/lib/ansible/runner/ **init**.py#L456-L459](https://github.com/ansible/ansible/blob/6e9fa5019f3d43500d6ad65bccf4291ffc550320/lib/ansible/runner/ __init__.py#L456-L459)

---

<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:** [September 13, 2013, 1:27pm UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/12 "2013-09-13T13:27:46Z")

</div>

I’m not sure why you say it’s executed once per each RPM in the list.

Can you post an example and output of the playbook that would show this case?

---

<div class="post-metadata">

**Author:** ![Hiroaki\_Nakamura](https://avatars.discourse-cdn.com/v4/letter/h/e480ec/32.png) [@Hiroaki\_Nakamura](https://forum.ansible.com/u/Hiroaki_Nakamura)\
**Post date:** [September 14, 2013, 6:30am UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/13 "2013-09-14T06:30:18Z")

</div>

Hi, Michael.

Here is a result of my playbook.  
[https://gist.github.com/hnakamur/6559322](https://gist.github.com/hnakamur/6559322)

tasks  
[https://github.com/hnakamur/ansible-playbooks/blob/master/roles/mysql/client/tasks/main.yml](https://github.com/hnakamur/ansible-playbooks/blob/master/roles/mysql/client/tasks/main.yml)

variables  
[https://github.com/hnakamur/ansible-playbooks/blob/master/roles/mysql/client/vars/main.yml](https://github.com/hnakamur/ansible-playbooks/blob/master/roles/mysql/client/vars/main.yml)

I use a list of objects, not a list of strings, as items.

So this is an expected result and I’m happy with it.

---

<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:** [September 14, 2013, 6:43pm UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/14 "2013-09-14T18:43:12Z")

</div>

This is probably because of the way you are using with\_items.

---

<div class="post-metadata">

**Author:** ![Hiroaki\_Nakamura](https://avatars.discourse-cdn.com/v4/letter/h/e480ec/32.png) [@Hiroaki\_Nakamura](https://forum.ansible.com/u/Hiroaki_Nakamura)\
**Post date:** [September 14, 2013, 9:06pm UTC](https://forum.ansible.com/t/pull-request-rpm-module/13356/15 "2013-09-14T21:06:57Z")

</div>

Yes, you are right.

To sum it up, if we pass a list of strings to with\_items, the yum module will run yum with all items at once.  
If we pass a list of compound objects, the yum module will run yum for each item.
