conda: use bash to execute the shell command.

This commit is contained in:
Andrea Dell'Amico 2018-01-05 12:58:17 +01:00
parent c6c4584ea9
commit 01a9ed7f3b
1 changed files with 10 additions and 6 deletions

View File

@ -20,19 +20,23 @@
- block: - block:
- name: Create a conda environment - name: Create a conda environment
shell: export PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }} ; conda create -y -n {{ item.env_name }} {{ item.env_opts }} # shell: export PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }} ; {{ conda_install_prefix }}/bin/conda create -y -n {{ item.env_name }} {{ item.env_opts }}
environment: shell: conda create -y -n {{ item.env_name }} {{ item.env_opts }}
PATH: 'PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }}'
args: args:
creates: '{{ conda_install_prefix }}/envs/{{ item.env_name }}' creates: '{{ conda_install_prefix }}/envs/{{ item.env_name }}'
executable: /bin/bash
environment:
PATH: 'PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }}'
with_items: '{{ conda_env_pkgs }}' with_items: '{{ conda_env_pkgs }}'
- name: Install additional packages and libraries inside the conda environment - name: Install additional packages and libraries inside the conda environment
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 }} #shell: export PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }} ; source {{ conda_install_prefix }}/bin/activate {{ item.env_name }} ; {{ conda_install_prefix }}/bin/conda install -y {{ item.repo_list }} {{ item.pkg }} ; touch {{ conda_install_prefix }}/envs/{{ item.env_name }}/.{{ item.pkg }}
shell: source activate {{ item.env_name }} ; conda install -y {{ item.repo_list }} {{ item.pkg }} ; touch {{ conda_install_prefix }}/envs/{{ item.env_name }}/.{{ item.pkg }}
args:
executable: /bin/bash
creates: '{{ conda_install_prefix }}/envs/{{ item.env_name }}/.{{ item.pkg }}'
environment: environment:
PATH: 'PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }}' PATH: 'PATH={{ conda_install_prefix }}/bin:{{ ansible_env.PATH }}'
args:
creates: '{{ conda_install_prefix }}/envs/{{ item.env_name }}/.{{ item.pkg }}'
with_items: '{{ conda_env_pkgs }}' with_items: '{{ conda_env_pkgs }}'
become: True become: True