diff --git a/tasks/py3_el.yml b/tasks/py3_el.yml index 4eaa558..b82fa92 100644 --- a/tasks/py3_el.yml +++ b/tasks/py3_el.yml @@ -6,21 +6,50 @@ - name: Install the python3 EL additional packages yum: name={{ py3_el_env_pkg }} state={{ py3_env_pkgs_state }} + - name: Find the pip3 executable + stat: + path: '/usr/local/bin/pip{{ py3_env_major_version }}' + register: pip3_path_executable + - name: Ensure that we have the latest pip, setuptools and wheel versions pip: - executable: 'pip{{ py3_env_major_version }}' + executable: '/usr/local/bin/pip{{ py3_env_major_version }}' name: '{{ py3_env_pip_default_pkgs }}' state: latest + when: pip3_path_executable.stat.exists + + - name: Ensure that we have the latest pip, setuptools and wheel versions + pip: + executable: '/usr/bin/pip{{ py3_env_major_version }}' + name: '{{ py3_env_pip_default_pkgs }}' + state: latest + when: not pip3_path_executable.stat.exists - name: Install a list of binary pip3 packages in wheels format - pip: executable=pip{{ py3_env_major_version }} name={{ py3_env_wheel_pip_pkgs }} state={{ py3_pip_pkgs_state }} + pip: executable=/usr/local/bin/pip{{ py3_env_major_version }} name={{ py3_env_wheel_pip_pkgs }} state={{ py3_pip_pkgs_state }} + when: pip3_path_executable.stat.exists + + - name: Install a list of binary pip3 packages in wheels format + pip: executable=/usr/bin/pip{{ py3_env_major_version }} name={{ py3_env_wheel_pip_pkgs }} state={{ py3_pip_pkgs_state }} + when: not pip3_path_executable.stat.exists - name: Install a list of versioned pip3 packages on EL - pip: executable=pip{{ py3_env_major_version }} name={{ item.pkg }} version={{ item.version }} extra_args={{ item.extra_args | default('') }} + pip: executable=/usr/local/bin/pip{{ py3_env_major_version }} name={{ item.pkg }} version={{ item.version }} extra_args={{ item.extra_args | default('') }} with_items: '{{ py3_env_versioned_pip_pkgs | default ([]) }}' + when: pip3_path_executable.stat.exists + + - name: Install a list of versioned pip3 packages on EL + pip: executable=/usr/bin/pip{{ py3_env_major_version }} name={{ item.pkg }} version={{ item.version }} extra_args={{ item.extra_args | default('') }} + with_items: '{{ py3_env_versioned_pip_pkgs | default ([]) }}' + when: not pip3_path_executable.stat.exists - name: Install a list of pip3 packages on EL - pip: executable=pip{{ py3_env_major_version }} name={{ py3_env_pip_pkgs }} state={{ py3_pip_pkgs_state }} + pip: executable=/usr/local/bin/pip{{ py3_env_major_version }} name={{ py3_env_pip_pkgs }} state={{ py3_pip_pkgs_state }} + when: pip3_path_executable.stat.exists + + - name: Install a list of pip3 packages on EL + pip: executable=/usr/bin/pip{{ py3_env_major_version }} name={{ py3_env_pip_pkgs }} state={{ py3_pip_pkgs_state }} + when: not pip3_path_executable.stat.exists when: py3_env_install tags: [ "python", "py3_env", "py3_env_pkgs", 'python3' ]