From 38b332ae2aaa07fa0eeb5708f4ea51e7818f3a79 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 6 Jul 2016 14:35:38 +0200 Subject: [PATCH] library/roles/python-env: Simple role to manage the pip and deb pkgs python modules installation. --- python-env/defaults/main.yml | 11 +++++++++++ python-env/tasks/main.yml | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 python-env/defaults/main.yml create mode 100644 python-env/tasks/main.yml diff --git a/python-env/defaults/main.yml b/python-env/defaults/main.yml new file mode 100644 index 00000000..e45d9765 --- /dev/null +++ b/python-env/defaults/main.yml @@ -0,0 +1,11 @@ +--- +py_env_pkgs_state: installed +py_env_site: False +py_env_basic_pkgs: + - python-pip + +py_env_dpkg: + +py_pip_deps: + +py_env_pip_pkgs: diff --git a/python-env/tasks/main.yml b/python-env/tasks/main.yml new file mode 100644 index 00000000..c71f7311 --- /dev/null +++ b/python-env/tasks/main.yml @@ -0,0 +1,21 @@ +--- +- name: Install python pip + apt: name={{ item }} state={{ py_env_pkgs_state }} + with_items: py_env_basic_pkgs + tags: [ "python", "py_env" ] + +- name: Install python deb packages + apt: name={{ item }} state={{ py_env_pkgs_state }} + with_items: '{{ py_env_dpkg | default([]) }}' + tags: [ "python", "py_env" ] + +- name: Install deb packages needed to compile the pip modules + apt: name={{ item }} state={{ py_env_pkgs_state }} + with_items: '{{ py_pip_deps | default([]) }}' + tags: [ "python", "py_env" ] + +- name: Install a list of pip packages + pip: name={{ item }} virtualenv={{ py_env_env_base_dir }} + with_items: '{{ py_env_pip_pkgs | default ()[] }}' + tags: [ "python", "py_env" ] +