Updated mirror and rollback
diff --git a/defaults/main.yml b/defaults/main.yml index 21eb84f..33d05b3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml
@@ -1,5 +1,5 @@ --- # defaults file for apigee-opdk-setup-epel -#epel_repo: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" +epel_repo: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" #epel_6_repo: https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm #epel_7_repo: http://elrepo.org/linux/extras/el7/x86_64/RPMS/elrepo-release-7-0.el7.elrepo.noarch.rpm
diff --git a/tasks/main.yml b/tasks/main.yml index ad3b427..0f9435a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml
@@ -13,10 +13,61 @@ shell: "subscription-manager register --username={{ rhel_user_name }} --password={{ rhel_password }} --auto-attach" when: ansible_distribution | lower == 'redhat' and ansible_distribution_major_version | version_compare('7', '>') -- name: Configure EPEL with no proxy - include_tasks: with_no_proxy.yml - when: (https_proxy is not defined or https_proxy | trim == '') and (http_proxy is not defined or http_proxy | trim == '') and (no_proxy is not defined or no_proxy | trim == '') +- name: Update EPEL with proxy + become: yes + yum: + name: epel-release + state: absent + when: opdk_version | version_compare('4.16.09', '==') + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" -- name: Configure EPEL with proxy - include_tasks: with_proxy.yml - when: (https_proxy is defined or https_proxy | trim != '') and (http_proxy is defined or http_proxy | trim != '') and (no_proxy is defined or no_proxy | trim != '') +- name: Update EPEL with proxy + become: yes + yum: + name: epel-release + state: present + allow_downgrade: yes + when: opdk_version | version_compare('4.17.05', '>') + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" + +- block: + - name: Remove epel + become: yes + yum: + name: epel-release + state: absent + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" + + - name: Yum clean + become: yes + shell: "yum clean all" + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" + + - name: Remove yum cache + become: yes + file: + path: /var/cache/yum + state: absent + + - name: Update EPEL with proxy + become: yes + yum: + name: "{{ epel_repo }}" + state: present + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" + when: opdk_version | version_compare('4.17.05', '<=')
diff --git a/tasks/with_proxy.yml b/tasks/with_proxy.yml index e17ff6b..7958b4a 100644 --- a/tasks/with_proxy.yml +++ b/tasks/with_proxy.yml
@@ -1,29 +1,62 @@ --- # tasks file for apigee-opdk-setup-epel - name: Update EPEL with proxy + become: yes yum: name: epel-release state: absent + when: opdk_version | version_compare('4.16.09', '==') environment: http_proxy: "{{ http_proxy }}" https_proxy: "{{ https_proxy }}" no_proxy: "{{ no_proxy }}" - name: Update EPEL with proxy + become: yes yum: name: epel-release state: present allow_downgrade: yes + when: opdk_version | version_compare('4.17.05', '>') environment: http_proxy: "{{ http_proxy }}" https_proxy: "{{ https_proxy }}" no_proxy: "{{ no_proxy }}" -- name: Update EPEL with proxy - yum: - name: "{{ epel_repo }}" - state: present - environment: - http_proxy: "{{ http_proxy }}" - https_proxy: "{{ https_proxy }}" - no_proxy: "{{ no_proxy }}" +- block: + - name: Remove epel + become: yes + yum: + name: epel-release + state: absent + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" + + - name: Yum clean + become: yes + shell: "yum clean all" + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" + + - name: Remove yum cache + become: yes + file: + path: /var/cache/yum + state: absent + + - name: Update EPEL with proxy + become: yes + yum: + name: "{{ epel_repo }}" + state: present + no_proxy: "{{ no_proxy }}" + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" + + when: opdk_version | version_compare('4.17.05', '<=')