From 46b8510a1d73857807c5c3960971a80b62885868 Mon Sep 17 00:00:00 2001 From: Rob Hirschfeld Date: Mon, 11 Apr 2016 16:34:46 -0500 Subject: [PATCH] add code to detect if epel is already installed and skip it if it is --- roles/kubernetes/preinstall/tasks/main.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index 17f0e893c..08f45d88e 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -78,10 +78,17 @@ ansible_distribution_major_version > 21 changed_when: False +- name: Check if epel-release-7-5.noarch is installed + command: rpm -q epel-release-7-5.noarch + register: epel_check + when: ansible_distribution in ["CentOS","RedHat"] and + ansible_distribution_major_version >= 7 + - name: Install epel-release on RedHat/CentOS command: rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm when: ansible_distribution in ["CentOS","RedHat"] and - ansible_distribution_major_version >= 7 + ansible_distribution_major_version >= 7 and + epel_check.stdout.find('is not installed') != -1 changed_when: False - name: Install packages requirements