Installing EPEL for Centos/RHEL 6 and 7 in the same play, using 'when' conditionals. Previously it worked just for version 6

pull/63/head
Juan Francisco Ottonello 9 years ago
parent 36ad14d24e
commit c709b262a8
  1. 16
      tomcat-standalone/roles/selinux/tasks/main.yml

@ -1,9 +1,21 @@
---
- name: Download EPEL Repo
# Download and install EPEL for Centos/RHEL version 6
- name: Download EPEL Repo - Centos/RHEL 6
get_url: url=http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm dest=/tmp/epel-release-6-8.noarch.rpm
when: "ansible_os_family == 'RedHat' and ansible_distribution_major_version == '6'"
- name: Install EPEL Repo
- name: Install EPEL Repo - Centos/RHEL 6
command: rpm -ivh /tmp/epel-release-6-8.noarch.rpm creates=/etc/yum.repos.d/epel.repo
when: "ansible_os_family == 'RedHat' and ansible_distribution_major_version == '6'"
# Download and install EPEL for Centos/RHEL version 7
- name: Download EPEL Repo - Centos/RHEL 7
get_url: url=http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm dest=/tmp/epel-release-7-5.noarch.rpm
when: "ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7'"
- name: Install EPEL Repo - Centos/RHEL 7
command: rpm -ivh /tmp/epel-release-7-5.noarch.rpm creates=/etc/yum.repos.d/epel.repo
when: "ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7'"
- name: Install libselinux-python
yum: name=libselinux-python