From 9a779358c423161582f3087ab1b92dacc2217ca3 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Sat, 2 Sep 2017 17:15:03 +0200 Subject: [PATCH] python-env role: Add a task that permits to install specific versions of pip packages. --- python-env/tasks/main.yml | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/python-env/tasks/main.yml b/python-env/tasks/main.yml index b675ca12..074cad3f 100644 --- a/python-env/tasks/main.yml +++ b/python-env/tasks/main.yml @@ -12,20 +12,6 @@ apt: name={{ item }} state={{ py_env_pkgs_state }} update_cache=yes cache_valid_time=600 with_items: '{{ py_pip_deps | default([]) }}' - - name: Fix the ssl warnings installing some ssl libraries - pip: name={{ item }} - with_items: '{{ py_env_pip_fix_ssl_warnings | default ([]) }}' - when: - - not py_env_trusty_workaround - - is_trusty - - - name: Install a list of pip packages - pip: name={{ item }} - with_items: '{{ py_env_pip_pkgs | default ([]) }}' - when: - - not py_env_trusty_workaround - - is_trusty - when: py_env_install tags: [ "python", "py_env" ] @@ -51,6 +37,13 @@ - name: Install setuptools version 33.1.1 pip: name=setuptools version=33.1.1 state=present + when: + - py_env_trusty_workaround + - py_env_install + - is_trusty + tags: [ "python", "py_env" ] + +- block: - name: Fix the ssl warnings installing some ssl libraries pip: name={{ item }} with_items: '{{ py_env_pip_fix_ssl_warnings | default ([]) }}' @@ -59,8 +52,9 @@ pip: name={{ item }} with_items: '{{ py_env_pip_pkgs | default ([]) }}' - when: - - py_env_trusty_workaround - - py_env_install - - is_trusty - tags: [ "python", "py_env" ] + - name: Install a list of versioned pip packages + pip: name={{ item.pkg }} version={{ item.version }} + with_items: '{{ py_env_versioned_pip_pkgs | default ([]) }}' + + when: py_env_install + tags: [ "python", "py_env", "py_env_pkgs" ]