Refactored pip configuration out of proxy sections
diff --git a/defaults/main.yml b/defaults/main.yml index ee0efc8..5abdb33 100644 --- a/defaults/main.yml +++ b/defaults/main.yml
@@ -23,4 +23,27 @@ - pexpect - passlib - requests -- kazoo \ No newline at end of file +- kazoo + +yum_repositories: +- { name: rhel-7-server-extras-rpms, + baseurl: "https://luxfavlpa001.verizon.com/pulp/repos/Verizon/1m0w-1w/RHEL7_SOE/content/dist/rhel/server/7/7Server/$basearch/extras/os" + } +- { name: rhel-7-server-optional-rpms, + baseurl: "https://luxfavlpa001.verizon.com/pulp/repos/Verizon/1m0w-1w/RHEL7_SOE/content/dist/rhel/server/7/7Server/$basearch/optional/os" + } +- { name: rhel-7-server-rpms, + baseurl: "https://luxfavlpa001.verizon.com/pulp/repos/Verizon/1m0w-1w/RHEL7_SOE/content/dist/rhel/server/7/7Server/$basearch/os" + } +- { name: rhel-7-server-satellite-tools-6.2-rpms, + baseurl: "https://luxfavlpa001.verizon.com/pulp/repos/Verizon/1m0w-1w/RHEL7_SOE/content/dist/rhel/server/7/7Server/$basearch/rhscl/1/os" + } +- { name: rhel-server-rhscl-7-rpms, + baseurl: "https://luxfavlpa001.verizon.com/pulp/repos/Verizon/1m0w-1w/RHEL7_SOE/content/dist/rhel/server/7/7Server/$basearch/rhscl/1/os" + } +- { name: rhel-7-server-rhn-tools-rpms, + baseurl: "https://luxfavlpa001.verizon.com/pulp/repos/Verizon/1m0w-1w/RHEL7_SOE/content/dist/rhel/server/7/7Server/$basearch/rhn-tools/os" + } +- { name: rhel-7-server-thirdparty-oracle-java-rpms, + baseurl: " https://luxfavlpa001.verizon.com/pulp/repos/Verizon/1m0w-1w/RHEL7_SOE/content/dist/rhel/server/7/7Server/$basearch/oracle-java/os" + } \ No newline at end of file
diff --git a/tasks/main.yml b/tasks/main.yml index a93204b..d2834fe 100644 --- a/tasks/main.yml +++ b/tasks/main.yml
@@ -2,7 +2,7 @@ # tasks file for apigee-opdk-setup-os - name: Configure AWS AMI OS package manager repositories for Apigee - shell: "/usr/bin/yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional" + shell: "yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional" when: ansible_bios_version | lower | search('amazon') and ansible_os_family | lower == 'redhat' and ansible_distribution_major_version | version_compare('6', '>') # TODO: Look up the ansible_distribution name for RHEL systems @@ -10,9 +10,30 @@ # shell: "subscription-manager register --username={{ rhel_user_name }} --password={{ rhel_password }} --auto-attach" # when: ansible_bios_version | lower | search('amazon') and ansible_os_family | lower == 'redhat' and ansible_distribution_major_version | version_compare('7', '>') +- name: Enable Yum repositories + yum_repository: + enabled: yes + state: present + name: "{{ items.name }}" + baseurl: "{{ items.baseurl }}" + file: 'redhat' + with_items: "{{ yum_repositories }}" + - name: Yum clean become: yes - shell: /usr/bin/yum clean all + shell: "yum clean all" + +- name: Create pip config folder + file: + path: "{{ pip_conf_dir }}" + state: directory + when: pip_conf_dir is defined + +- name: Configure pip + template: + src: pip.conf.j2 + 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 @@ -21,3 +42,11 @@ - name: Use proxy definitions include: with_proxy.yml when: http_proxy is defined and https_proxy is defined + +- name: Update python packages + become: yes + pip: + name: '{{ item }}' + state: present + with_items: "{{ pip_packages }}" +
diff --git a/tasks/with_no_proxy.yml b/tasks/with_no_proxy.yml index 9100d15..656ea66 100644 --- a/tasks/with_no_proxy.yml +++ b/tasks/with_no_proxy.yml
@@ -56,18 +56,6 @@ line: 'export CONTINUE_ON_WARNING={{ apigee_continue_on_warning }}' backup: yes -- name: Create pip config folder - file: - path: "{{ pip_conf_dir }}" - state: directory - when: pip_conf_dir is defined - -- name: Configure pip - template: - src: pip.conf.j2 - dest: "{{ pip_conf_dir }}/pip.conf" - when: pip_conf_dir is defined and pip_index_url is defined - - name: Download pip package manager become: yes tags: ['pip-manager']
diff --git a/tasks/with_proxy.yml b/tasks/with_proxy.yml index c66b100..9d58568 100644 --- a/tasks/with_proxy.yml +++ b/tasks/with_proxy.yml
@@ -59,18 +59,6 @@ line: 'export CONTINUE_ON_WARNING={{ apigee_continue_on_warning }}' backup: yes -- name: Create pip config folder - file: - path: "{{ pip_conf_dir }}" - state: directory - when: pip_conf_dir is defined - -- name: Configure pip - template: - src: pip.conf.j2 - dest: "{{ pip_conf_dir }}/pip.conf" - when: pip_conf_dir is defined and pip_index_url is defined - - name: Download pip package manager become: yes tags: ['pip-manager'] @@ -90,13 +78,3 @@ environment: http_proxy: "{{ http_proxy }}" https_proxy: "{{ https_proxy }}" - -- name: Update python packages - become: yes - pip: - name: '{{ item }}' - state: present - with_items: "{{ pip_packages }}" -# environment: -# http_proxy: "{{ http_proxy }}" -# https_proxy: "{{ https_proxy }}"