From 831a54e9b7965eedf1d5109aed7164b548c7873e Mon Sep 17 00:00:00 2001 From: Rob Hirschfeld Date: Mon, 11 Apr 2016 16:34:46 -0500 Subject: [PATCH 1/3] add code to detect if epel is already installed and skip it if it is add option for generic --- roles/kubernetes/preinstall/tasks/main.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index 36a444675..08f45d88e 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -48,8 +48,8 @@ - name: check cloud_provider value fail: - msg: "If set the 'cloud_provider' var must be set either to 'gce', 'aws' or 'openstack'" - when: cloud_provider is defined and cloud_provider not in ['gce', 'aws', 'openstack'] + msg: "If set the 'cloud_provider' var must be set either to 'generic', gce', 'aws' or 'openstack'" + when: cloud_provider is defined and cloud_provider not in ['generic', 'gce', 'aws', 'openstack'] - include: openstack-credential-check.yml when: cloud_provider is defined and cloud_provider == 'openstack' @@ -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 From f12ad6a56fe1c94c0b03d03960f7502282c77939 Mon Sep 17 00:00:00 2001 From: Rob Hirschfeld Date: Tue, 12 Apr 2016 18:41:46 -0700 Subject: [PATCH 2/3] consolidate EPEL change into a single task as per @smana request --- roles/kubernetes/preinstall/tasks/main.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index 08f45d88e..33fc38b0d 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -78,17 +78,10 @@ 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 +- name: Install epel-release on RedHat/CentOS + shell: rpm -qa | grep epel-release || 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 - -- 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 and - epel_check.stdout.find('is not installed') != -1 changed_when: False - name: Install packages requirements From fb980e4542307a2b58d30c901e7d529548688fba Mon Sep 17 00:00:00 2001 From: Rob Hirschfeld Date: Tue, 12 Apr 2016 18:43:31 -0700 Subject: [PATCH 3/3] missed tick in message cosmetic --- roles/kubernetes/preinstall/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index 33fc38b0d..952319c27 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -48,7 +48,7 @@ - name: check cloud_provider value fail: - msg: "If set the 'cloud_provider' var must be set either to 'generic', gce', 'aws' or 'openstack'" + msg: "If set the 'cloud_provider' var must be set either to 'generic', 'gce', 'aws' or 'openstack'" when: cloud_provider is defined and cloud_provider not in ['generic', 'gce', 'aws', 'openstack'] - include: openstack-credential-check.yml