conda, dataminer: setup the environment before installing the packages.

This commit is contained in:
Andrea Dell'Amico 2018-01-05 12:43:35 +01:00
parent 7bdfd8ce07
commit 835df95a15
2 changed files with 6 additions and 9 deletions

View File

@ -7,9 +7,6 @@ conda_install_prefix: '/srv/conda{{ conda_ver }}'
# Change it to an unprivileged user
conda_user: root
#conda_environments:
# - { name: '', opts: '' }
#conda_env_pkgs:
# - { conda_prefix: '{{ conda_install_prefix }}', pkg: '', repo_list: '' }
# - { env_name: '', env_opts: '', conda_prefix: '{{ conda_install_prefix }}', pkg: '', repo_list: '' }

View File

@ -20,19 +20,19 @@
- block:
- name: Create a conda environment
shell: export PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }} ; conda create -y -n {{ item.name }} {{ item.opts }}
shell: export PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }} ; conda create -y -n {{ item.env_name }} {{ item.env_opts }}
environment:
PATH: 'PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }}'
args:
creates: '{{ conda_install_prefix }}/envs/{{ item.name }}'
with_items: '{{ conda_environments }}'
creates: '{{ conda_install_prefix }}/envs/{{ item.env_name }}'
with_items: '{{ conda_env_pkgs }}'
- name: Install additional packages and libraries inside the conda environment
shell: export PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }} ; conda install -y {{ item.repo_list }} {{ item.pkg }} ; touch {{ conda_install_prefix }}/.{{ item.pkg }}
shell: export PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }} ; source {{ conda_install_prefix }}/bin/activate {{ item.env_name }} ; conda install -y {{ item.repo_list }} {{ item.pkg }} ; touch {{ conda_install_prefix }}/envs/{{ item.env_name }}/.{{ item.pkg }}
environment:
PATH: 'PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }}'
args:
creates: '{{ conda_install_prefix }}/.{{ item.pkg }}'
creates: '{{ conda_install_prefix }}/envs/{{ item.env_name }}/.{{ item.pkg }}'
with_items: '{{ conda_env_pkgs }}'
when: conda_env_pkgs is defined