From b5561d76f2fa9b0c219042f85429289897d01092 Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Fri, 14 Jul 2017 09:44:25 -0700 Subject: [PATCH] Honor proxy settings during installation, connect epel properly for YUM --- roles/kubernetes/preinstall/tasks/main.yml | 55 ++++++++++++++-------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index 2f5bff229..1fd518c17 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -89,14 +89,44 @@ - inventory_hostname in groups['k8s-cluster'] tags: [network, calico, weave, canal, bootstrap-os] -- name: Update package management cache (YUM) - yum: - update_cache: yes - name: '*' - register: yum_task_result - until: yum_task_result|succeeded +- name: Install epel-release on non-YUM RedHat/CentOS + shell: rpm -qa | grep epel-release || rpm -ivh {{ epel_rpm_download_url }} + environment: + http_proxy: "{{http_proxy|default('')}}" + https_proxy: "{{https_proxy|default('')}}" + no_proxy: "{{no_proxy|default('')}}" + when: + - ansible_distribution in ["CentOS","RedHat"] + - ansible_pkg_mgr != 'yum' + - not is_atomic + register: epel_task_result + until: epel_task_result|succeeded retries: 4 delay: "{{ retry_stagger | random + 3 }}" + changed_when: False + check_mode: no + tags: bootstrap-os + +- block: + - name: Install and enable epel-release for YUM + yum_repository: + name: epel + description: YUM EPEL repo + baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/ + gpgkey: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-$releasever + enabled: yes + - name: yum-clean-metadata + command: yum clean metadata + args: + warn: no + - name: Update package management cache (YUM) + yum: + update_cache: yes + name: '*' + register: yum_task_result + until: yum_task_result|succeeded + retries: 4 + delay: "{{ retry_stagger | random + 3 }}" when: - ansible_pkg_mgr == 'yum' - not is_atomic @@ -123,19 +153,6 @@ changed_when: False tags: bootstrap-os -- name: Install epel-release on RedHat/CentOS - shell: rpm -qa | grep epel-release || rpm -ivh {{ epel_rpm_download_url }} - when: - - ansible_distribution in ["CentOS","RedHat"] - - not is_atomic - register: epel_task_result - until: epel_task_result|succeeded - retries: 4 - delay: "{{ retry_stagger | random + 3 }}" - changed_when: False - check_mode: no - tags: bootstrap-os - - name: Install packages requirements action: module: "{{ ansible_pkg_mgr }}"