Cleaned up os pip
diff --git a/tasks/main.yml b/tasks/main.yml index 72f024e..34900eb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml
@@ -13,11 +13,103 @@ dest: "{{ pip_conf_dir }}/pip.conf" when: pip_conf_dir is defined and pip_index_url is defined -- name: Do not use proxy definitions - include: with_no_proxy.yml - when: http_proxy is not defined and https_proxy is not defined +- block: + - name: Update pip with proxy + become: yes + pip: + name: pip + state: latest + register: result + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" -- name: Use proxy definitions - include: with_proxy.yml - when: http_proxy is defined and https_proxy is defined + rescue: + - block: + - name: Install pip with proxy + become: yes + yum: + name: python-pip + state: latest + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" + + rescue: + - name: Install epel with proxy + become: yes + import_role: + name: apigee-opdk-setup-os-epel + + - name: Install pip with proxy + become: yes + yum: + name: python-pip + state: latest + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" + + become: yes + +- name: Update pip packages with proxy + tags: ['pip'] + become: yes + pip: + name: '{{ item }}' + state: present + with_items: "{{ pip_packages }}" + environment: + http_proxy: "{{ http_proxy }}" + https_proxy: "{{ https_proxy }}" + no_proxy: "{{ no_proxy }}" + +#- name: Download pip package manager with proxy +# become: yes +# tags: ['pip-manager'] +# get_url: +# url: https://bootstrap.pypa.io/get-pip.py +# dest: /tmp/get-pip.py +# validate_certs: no +# when: pip_conf_dir is not defined +# environment: +# http_proxy: "{{ http_proxy }}" +# https_proxy: "{{ https_proxy }}" +# no_proxy: "{{ no_proxy }}" +# +#- name: Install pip package manager with proxy +# become: yes +# tags: ['pip-manager'] +# shell: python /tmp/get-pip.py +# when: pip_conf_dir is not defined +# environment: +# http_proxy: "{{ http_proxy }}" +# https_proxy: "{{ https_proxy }}" +# no_proxy: "{{ no_proxy }}" +# +#- name: Update pip +# tags: ['pip'] +# become: yes +# pip: +# name: pip +# state: latest +# environment: +# http_proxy: "{{ http_proxy }}" +# https_proxy: "{{ https_proxy }}" +# no_proxy: "{{ no_proxy }}" +# +#- name: Update python packages with no proxy +# tags: ['pip'] +# become: yes +# pip: +# name: '{{ item }}' +# state: present +# with_items: "{{ pip_packages }}" +# environment: +# http_proxy: "{{ http_proxy }}" +# https_proxy: "{{ https_proxy }}" +# no_proxy: "{{ no_proxy }}"
diff --git a/tasks/with_no_proxy.yml b/tasks/with_no_proxy.yml deleted file mode 100644 index f316498..0000000 --- a/tasks/with_no_proxy.yml +++ /dev/null
@@ -1,68 +0,0 @@ ---- -# tasks file for apigee-opdk-setup-os-pip -- block: - - name: Update pip - pip: - name: pip - state: latest - register: result - - rescue: - - - block: - - name: Install pip - yum: - name: python-pip - state: latest - - rescue: - - name: Install epel - import_role: - name: apigee-opdk-setup-os-epel - - - name: Install pip - yum: - name: python-pip - state: latest - - become: yes - -- name: Update pip packages - tags: ['pip'] - become: yes - pip: - name: '{{ item }}' - state: present - with_items: "{{ pip_packages }}" - -# TODO: Put get-pip into its own role. -# -# rescue: -# - name: Download pip package manager -# become: yes -# tags: ['pip-manager'] -# get_url: -# url: https://bootstrap.pypa.io/get-pip.py -# dest: /tmp/get-pip.py -# when: pip_conf_dir is not defined -# -# - name: Install pip package manager -# become: yes -# tags: ['pip-manager'] -# shell: python /tmp/get-pip.py -# when: pip_conf_dir is not defined -# -# - name: Update pip -# tags: ['pip'] -# become: yes -# pip: -# name: pip -# state: latest -# -# - name: Update pip packages -# tags: ['pip'] -# become: yes -# pip: -# name: '{{ item }}' -# state: present -# with_items: "{{ pip_packages }}"
diff --git a/tasks/with_proxy.yml b/tasks/with_proxy.yml deleted file mode 100644 index 22044a0..0000000 --- a/tasks/with_proxy.yml +++ /dev/null
@@ -1,101 +0,0 @@ ---- -- block: - - name: Update pip with proxy - become: yes - pip: - name: pip - state: latest - register: result - environment: - http_proxy: "{{ http_proxy }}" - https_proxy: "{{ https_proxy }}" - no_proxy: "{{ no_proxy }}" - - rescue: - - - block: - - name: Install pip with proxy - become: yes - yum: - name: python-pip - state: latest - environment: - http_proxy: "{{ http_proxy }}" - https_proxy: "{{ https_proxy }}" - no_proxy: "{{ no_proxy }}" - - rescue: - - name: Install epel with proxy - become: yes - import_role: - name: apigee-opdk-setup-os-epel - - - name: Install pip with proxy - become: yes - yum: - name: python-pip - state: latest - environment: - http_proxy: "{{ http_proxy }}" - https_proxy: "{{ https_proxy }}" - no_proxy: "{{ no_proxy }}" - - become: yes - -- name: Update pip packages with proxy - tags: ['pip'] - become: yes - pip: - name: '{{ item }}' - state: present - with_items: "{{ pip_packages }}" - environment: - http_proxy: "{{ http_proxy }}" - https_proxy: "{{ https_proxy }}" - no_proxy: "{{ no_proxy }}" - -#- name: Download pip package manager with proxy -# become: yes -# tags: ['pip-manager'] -# get_url: -# url: https://bootstrap.pypa.io/get-pip.py -# dest: /tmp/get-pip.py -# validate_certs: no -# when: pip_conf_dir is not defined -# environment: -# http_proxy: "{{ http_proxy }}" -# https_proxy: "{{ https_proxy }}" -# no_proxy: "{{ no_proxy }}" -# -#- name: Install pip package manager with proxy -# become: yes -# tags: ['pip-manager'] -# shell: python /tmp/get-pip.py -# when: pip_conf_dir is not defined -# environment: -# http_proxy: "{{ http_proxy }}" -# https_proxy: "{{ https_proxy }}" -# no_proxy: "{{ no_proxy }}" -# -#- name: Update pip -# tags: ['pip'] -# become: yes -# pip: -# name: pip -# state: latest -# environment: -# http_proxy: "{{ http_proxy }}" -# https_proxy: "{{ https_proxy }}" -# no_proxy: "{{ no_proxy }}" -# -#- name: Update python packages with no proxy -# tags: ['pip'] -# become: yes -# pip: -# name: '{{ item }}' -# state: present -# with_items: "{{ pip_packages }}" -# environment: -# http_proxy: "{{ http_proxy }}" -# https_proxy: "{{ https_proxy }}" -# no_proxy: "{{ no_proxy }}"