# Ansible yum module unable to find certain packages

**URL:** <https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076>\
**Category:** Ansible Project\
**Created:** [November 22, 2016, 7:27pm UTC](https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076 "2016-11-22T19:27:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeffrey\_Wen](https://avatars.discourse-cdn.com/v4/letter/j/90db22/32.png) [@Jeffrey\_Wen](https://forum.ansible.com/u/Jeffrey_Wen)\
**Post date:** [November 22, 2016, 7:27pm UTC](https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076/1 "2016-11-22T19:27:51Z")

</div>

My playbook that installs some generic applications on all of my servers:

`

- name: Install base applications  
yum: name={{ item }} state=present  
with\_items:
- epel-release
- vim-enhanced
- gcc
- wget
- libsemanage-python
- policycoreutils-python
- setroubleshoot
- tmux  
`

I get an error message for each of the following packages:  
`  
“msg”: “No package matching ‘libsemanage-python’ found available, installed or updated”, “rc”: 126

“msg”: “No package matching ‘policycoreutils-python’ found available, installed or updated”, “rc”: 126

“msg”: “No package matching 'setroubleshoot found available, installed or updated”, “rc”: 126

“msg”: “No package matching ‘tmux’ found available, installed or updated”, “rc”: 126  
`

If I remove those packages from the item list, the install goes through fine.

I have also verified that if I manually run the following command on the remote server, it exists  
`yum install libsemanage-python policycoreutils-python setroubleshoot tmux`

If I remove the package from the item list and install it individually, it will **work** :  
`

- name: Install libsemanage-python  
yum: name=libsemanage-python state=present  
`

**Has anyone run into a similar scenario and figured out why it is causing this?**

---

<div class="post-metadata">

**Author:** ![Alexander\_H\_Laughlin](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Alexander\_H\_Laughlin](https://forum.ansible.com/u/Alexander_H_Laughlin)\
**Post date:** [November 22, 2016, 10:23pm UTC](https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076/2 "2016-11-22T22:23:51Z")

</div>

I’m afraid I can’t reproduce this on a CentOS 7 vm running in virtualbox. Are you using RedHat? If so, which version?

The playbook I used for reference, along with the results.

`

(duchess) [duchess@centos:jeffrey-wen] cat yum.yml

---

<div class="post-metadata">

**Author:** ![Jeffrey\_Wen](https://avatars.discourse-cdn.com/v4/letter/j/90db22/32.png) [@Jeffrey\_Wen](https://forum.ansible.com/u/Jeffrey_Wen)\
**Post date:** [November 23, 2016, 2:50am UTC](https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076/3 "2016-11-23T02:50:35Z")

</div>

I am using Red Hat Enterprise Linux Server release 7.3 (Maipo)

---

<div class="post-metadata">

**Author:** ![Jeffrey\_Wen](https://avatars.discourse-cdn.com/v4/letter/j/90db22/32.png) [@Jeffrey\_Wen](https://forum.ansible.com/u/Jeffrey_Wen)\
**Post date:** [November 23, 2016, 2:19pm UTC](https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076/4 "2016-11-23T14:19:59Z")

</div>

I have confirmed that this does work on **CentOS Linux release 7.2.1511 (Core)**

However, it does not work on **Red Hat Enterprise Linux Server release 7.3 (Maipo)**

---

<div class="post-metadata">

**Author:** ![Alexander\_H\_Laughlin](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Alexander\_H\_Laughlin](https://forum.ansible.com/u/Alexander_H_Laughlin)\
**Post date:** [November 23, 2016, 8:27pm UTC](https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076/5 "2016-11-23T20:27:29Z")

</div>

I have not yet had time to set up a test bed for this, but I’m planning on doing that today so I’ll update you with my results.

---

<div class="post-metadata">

**Author:** ![Alexander\_H\_Laughlin](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Alexander\_H\_Laughlin](https://forum.ansible.com/u/Alexander_H_Laughlin)\
**Post date:** [November 24, 2016, 7:18am UTC](https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076/6 "2016-11-24T07:18:54Z")

</div>

I can reproduce this error on a Red Hat Enterprise Linux Server 7.3 Maipo vm.

`

(duchess) [duchess@localhost:jeffrey-wen] ansible-playbook yum.yml

PLAY [Test yum module installs.] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [setup] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [localhost]

TASK [Install base applications] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

failed: [localhost] (item=[u’epel-release’, u’vim-enhanced’, u’gcc’, u’wget’, u’libsemanage-python’, u’policycoreutils-python’, u’setroubleshoot’, u’tmux’]) =\> {“changed”:false,“failed”:true,“item”: [“epel-release”, “vim-enhanced”, “gcc”, “wget”, “libsemanage-python”, “policycoreutils-python”, “setroubleshoot”, “tmux”], “msg”: “No package matching ‘epel-release’ found available,installed or updated”, “rc”: 126, “results”: [“No package matching ‘epel-release’ found available, installed or updated”]}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

localhost : ok=1 changed=0 unreachable=0 failed=1

(duchess) [duchess@localhost:jeffrey-wen] ansible --version

ansible 2.2.0.0

config file = /etc/ansible/ansible.cfg

configured module search path = Default w/o overrides

(duchess) [duchess@localhost:jeffrey-wen] cat yum.yml

---

<div class="post-metadata">

**Author:** ![Jeffrey\_Wen](https://avatars.discourse-cdn.com/v4/letter/j/90db22/32.png) [@Jeffrey\_Wen](https://forum.ansible.com/u/Jeffrey_Wen)\
**Post date:** [November 24, 2016, 12:57pm UTC](https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076/7 "2016-11-24T12:57:32Z")

</div>

Hey Alexander,

Thank you so much for helping me out! However, there is still an issue with a few of the other packages.

For example: try removing epel-release from the list and watch it complain about a few of the other packages.

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [November 25, 2016, 7:50am UTC](https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076/8 "2016-11-25T07:50:29Z")

</div>

Isn't that because those packages are from EPEL ? You need to add the  
repo in one task,  
and then add the other packages in the second.

---

<div class="post-metadata">

**Author:** ![Alexander\_H\_Laughlin](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Alexander\_H\_Laughlin](https://forum.ansible.com/u/Alexander_H_Laughlin)\
**Post date:** [November 25, 2016, 9:14am UTC](https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076/9 "2016-11-25T09:14:39Z")

</div>

Indeed, it is not possible to install packages from the epel repo without first installing the repo in yum.

---

<div class="post-metadata">

**Author:** ![kprkumar528](https://avatars.discourse-cdn.com/v4/letter/k/c4cdca/32.png) [@kprkumar528](https://forum.ansible.com/u/kprkumar528)\
**Post date:** [June 8, 2018, 4:20pm UTC](https://forum.ansible.com/t/ansible-yum-module-unable-to-find-certain-packages/23076/10 "2018-06-08T16:20:09Z")

</div>

This happens on RHEL when you run the tasks as non-root user.  
Just specify become and become\_user in yum task to fix this issue
