Unable to add EPEL repo using Ansible - RHEL 7
<p>I am trying to install the EPEL repo on <code>Ansible</code> using a playbook. </p>

<p>The <code>play</code> I have is as follows:  </p>

<pre><code>- name: add epel repo   
  tags: addEpelRepo
          yum: name=https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm state=present
          register: epelRepoOut
          notify:
            - yum update
        - debug: var=epelRepoOut.stdout_lines
</code></pre>

<p>Even after executing this play, EPEL is not installed. Running <code>yum repolist</code> does not contain EPEL.<br>
My question(s):<br>
1. How do I enable the EPEL repo?<br>
2. I have also tried <code>yum_repository</code> module in the following play:  </p>

<pre><code>- name: Add repository
  yum_repository:
    name: epel
    description: EPEL YUM repo
    baseurl: http://download.fedoraproject.org/pub/epel/$releasever/$basearch/
</code></pre>

<p>While an EPEL repo file gets created in <code>/etc/yum.repos.d/</code>, I am unable to install anything from this file. How do I get this right?  </p>

<p>UPDATE:  Output is:  </p>

<pre><code>ok: [localhost] =&gt; {
    "changed": false,
    "invocation": {
        "module_args": {
            "conf_file": null,
            "disable_gpg_check": true,
            "disablerepo": null,
            "enablerepo": null,
            "exclude": null,
            "install_repoquery": true,
            "list": null,
            "name": [
                "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
            ],
            "state": "present",
            "update_cache": false,
            "validate_certs": true
        },
        "module_name": "yum"
    },
    "msg": "",
    "rc": 0,
    "results": []
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0
</code></pre>