cleaned up role
diff --git a/tasks/main.yml b/tasks/main.yml index fd76114..44114ed 100644 --- a/tasks/main.yml +++ b/tasks/main.yml
@@ -1,9 +1,50 @@ --- # tasks file for apigee-opdk-setup-os-common-extra -- name: Do not use proxy definitions - include: with_no_proxy.yml - when: (https_proxy is not defined or https_proxy | trim == '') and (http_proxy is not defined or http_proxy | trim == '') +- block: -- name: Use proxy definitions - include: with_proxy.yml - when: https_proxy is defined and https_proxy | trim != '' and http_proxy is defined and http_proxy | trim != '' + - name: Update troubleshooting OS packages + become: yes + yum: + name: "{{ item }}" + state: present + with_items: "{{ os_packages }}" + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" + + rescue: + + - name: Check for existence of epel.repo + stat: + path: /etc/yum.repos.d/epel.repo + register: epel + + - block: + + - name: expose baseurl in epel.repo definition + replace: + backup: yes + regexp: '^(#baseurl=)(.*)' + replace: 'baseurl=\2' + dest: '/etc/yum.repos.d/epel.repo' + + - name: remove mirrorlist in epel.repo definition + replace: + backup: yes + regexp: '^(mirrorlist=)(.*)' + replace: '#mirrorlist=\2' + dest: /etc/yum.repos.d/epel.repo" + + when: epel.stat.exists + + - name: Update troubleshooting OS packages + become: yes + yum: + name: "{{ item }}" + state: present + with_items: "{{ os_packages }}" + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}"
diff --git a/tasks/with_proxy.yml b/tasks/with_proxy.yml index 4cce07b..ed97d53 100644 --- a/tasks/with_proxy.yml +++ b/tasks/with_proxy.yml
@@ -1,49 +1 @@ --- -- block: - - - name: Update troubleshooting OS packages - become: yes - yum: - name: "{{ item }}" - state: present - with_items: "{{ os_packages }}" - environment: - http_proxy: "{{ http_proxy }}" - https_proxy: "{{ https_proxy }}" - no_proxy: "{{ no_proxy }}" - - rescue: - - - name: Check for existence of epel.repo - stat: - path: /etc/yum.repos.d/epel.repo - register: epel - - - block: - - - name: expose baseurl in epel.repo definition - replace: - backup: yes - regexp: '^(#baseurl=)(.*)' - replace: 'baseurl=\2' - dest: '/etc/yum.repos.d/epel.repo' - - - name: remove mirrorlist in epel.repo definition - replace: - backup: yes - regexp: '^(mirrorlist=)(.*)' - replace: '#mirrorlist=\2' - dest: /etc/yum.repos.d/epel.repo" - - when: epel.stat.exists - - - name: Update troubleshooting OS packages - become: yes - yum: - name: "{{ item }}" - state: present - with_items: "{{ os_packages }}" - environment: - http_proxy: "{{ http_proxy }}" - https_proxy: "{{ https_proxy }}" - no_proxy: "{{ no_proxy }}"