--- - block: - name: Install the python 3 ppa repository apt_repository: repo={{ py3_ppa }} update_cache=yes state=present - name: Install the python3 deb packages apt: name={{ py3_env_dpkg }} state={{ py3_env_pkgs_state }} update_cache=yes cache_valid_time=600 - name: Install the correct pip3 version shell: python{{ py3_env_version }} -m ensurepip && pip{{ py3_env_version }} install --upgrade pip setuptools wheel - name: Install a list of pip packages pip: executable=pip{{ py3_env_version }} name={{ py3_env_pip_pkgs }} state=latest - name: Install a list of versioned pip packages pip: executable=pip{{ py3_env_version }} name={{ item.pkg }} version={{ item.version }} with_items: '{{ py3_env_versioned_pip_pkgs | default ([]) }}' when: - py3_env_install - is_trusty tags: [ "python", "py3_env", "py3_env_pkgs", 'python3' ]