feat(conda): Add conda env setup basics
This commit is contained in:
@@ -1,3 +1,55 @@
|
||||
- name: 'Set conda env file basename'
|
||||
tags:
|
||||
- 'testing'
|
||||
set_fact:
|
||||
conda_env_file_base: '{{ conda_env_file | basename }}'
|
||||
|
||||
|
||||
|
||||
- name: 'Set conda env file absolute path'
|
||||
tags:
|
||||
- 'testing'
|
||||
set_fact:
|
||||
conda_env_file_abs: '{{ miniconda_envs_dir }}/{{ conda_env_file_base | regex_search(''.*?\.yml'', ''\0'') | first }}'
|
||||
|
||||
|
||||
|
||||
- name: 'Set conda env name'
|
||||
tags:
|
||||
- 'testing'
|
||||
set_fact:
|
||||
conda_env_name: '{{ conda_env_file_base | regex_search(''(.*?)(_conda_environment.yml)'', ''\1'') | first }}'
|
||||
|
||||
|
||||
|
||||
- name: 'Store conda environment.yml file'
|
||||
ansible.builtin.template:
|
||||
src: '{{ conda_env_file }}'
|
||||
dest: '{{ conda_env_file_abs }}'
|
||||
|
||||
|
||||
|
||||
- name: 'Set up conda env ''{{ conda_env_name }}'''
|
||||
tags:
|
||||
- 'testing'
|
||||
register: 'rv_conda_env_install'
|
||||
changed_when: 'not rv_conda_env_install.stderr'
|
||||
failed_when: 'false'
|
||||
ansible.builtin.shell: '{{ miniconda_conda_binary }} env create --quiet --file ''{{ conda_env_file_abs }}'''
|
||||
|
||||
|
||||
|
||||
#
|
||||
#- name: Display paths of all .txt files in dir
|
||||
# tags:
|
||||
# - 'testing'
|
||||
# ansible.builtin.debug: msg={{ lookup('ansible.builtin.fileglob', '_conda_envs_dir_/**', wantlist=True) }}
|
||||
|
||||
- name: 'Debug vars'
|
||||
tags:
|
||||
- 'testing'
|
||||
debug:
|
||||
msg: 'asd'
|
||||
|
||||
|
||||
|
||||
|
@@ -1 +1,10 @@
|
||||
- import_tasks: '50-setup-miniconda-env.yml'
|
||||
- import_tasks: '40-install-miniconda.yml'
|
||||
- name: 'Set up conda environment'
|
||||
tags:
|
||||
- 'testing'
|
||||
loop_control:
|
||||
loop_var: 'conda_env'
|
||||
loop: '{{ lookup(''ansible.builtin.fileglob'', ''{{ role_path }}/templates/{{ conda_envs_template_dir }}/*'', wantlist=True) | map(''regex_search'', conda_envs_template_dir + ''/.*?_conda_environment.yml.j2'') }}'
|
||||
vars:
|
||||
conda_env_file: '{{ conda_env }}'
|
||||
include_tasks: '50-setup-miniconda-env.yml'
|
||||
|
Reference in New Issue
Block a user