# "Correct" way to install EPEL rpms?

**URL:** <https://forum.ansible.com/t/correct-way-to-install-epel-rpms/14948>\
**Category:** Ansible Project\
**Created:** [April 5, 2014, 7:52pm UTC](https://forum.ansible.com/t/correct-way-to-install-epel-rpms/14948 "2014-04-05T19:52:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@Sean](https://forum.ansible.com/u/Sean)\
**Post date:** [April 5, 2014, 7:52pm UTC](https://forum.ansible.com/t/correct-way-to-install-epel-rpms/14948/1 "2014-04-05T19:52:11Z")

</div>

TASK: [common | yum install epel packages] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

failed: [ceph-osd1] =\> {“changed”: true, “item”: “”, “rc”: 1, “results”: [“Loaded plugins: fastestmirror, security\nDetermining fastest mirrors\nCould not retrieve mirrorlist [http://mirrorlist.centos.org/?release=6&arch=x86\_64&repo=os](http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os) error was\n14: PYCURL ERROR 6 - "Couldn’t resolve host ‘[mirrorlist.centos.org](http://mirrorlist.centos.org)’"\n”]}

msg: Error: Cannot find a valid baseurl for repo: base

I am running my playbook toward the vagrant vms on my laptop, so maybe my home network (bandwidth) caused the problem? I guess this is because I pointed to one URL and somehow it timed out (I have not clue).

Is there anyway to make this task more robust? Can yum module put a list of repos instead of pointing to a hardcoded URL?

---------------Related tasks in my playbook------------

- name: yum install epel packages

yum: name=[http://dl.fedoraproject.org/pub/epel/6/x86\_64/epel-release-6-8.noarch.rpm](http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm) state=present

---

<div class="post-metadata">

**Author:** ![Paul\_Durivage](https://avatars.discourse-cdn.com/v4/letter/p/94ad74/32.png) [@Paul\_Durivage](https://forum.ansible.com/u/Paul_Durivage)\
**Post date:** [April 6, 2014, 3:20pm UTC](https://forum.ansible.com/t/correct-way-to-install-epel-rpms/14948/2 "2014-04-06T15:20:47Z")

</div>

It says it could’t resolve [mirrorlist.centos.org](http://mirrorlist.centos.org), so you have a DNS problem – _at least_ a DNS problem. Because this is CentOS, I’d verify that the primary public interface (probably eth0) is enabled at boot and out from under network-manager control, particularly if you’re running it as a server and not a desktop.

I’d diagnose the networking issue, and then write a play/role that goes over the steps to resolving the issue, such that you can reuse the play/role again and again on CentOS VMs at build time.

As an example, you could use the[URI module](http://docs.ansible.com/uri_module.html) to verify a connection to [mirrorlist.centos.org](http://mirrorlist.centos.org) before proceeding.

---

<div class="post-metadata">

**Author:** ![F.L\_Jonathan\_Arana\_C](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@F.L\_Jonathan\_Arana\_C](https://forum.ansible.com/u/F.L_Jonathan_Arana_C)\
**Post date:** [April 6, 2014, 6:24pm UTC](https://forum.ansible.com/t/correct-way-to-install-epel-rpms/14948/3 "2014-04-06T18:24:53Z")

</div>

Id recomment using goozbach.EPEL role -  
[https://galaxy.ansible.com/list#/roles/35](https://galaxy.ansible.com/list#/roles/35)

it puts the needed repo files in place with no need to download anything.
