Skip to content

Commit

Permalink
refactored mincondapath
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Jan 29, 2024
1 parent c22775d commit 4fe5ac5
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions conda/conda.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
- name: Download Miniconda
get_url:
url: https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh # Adjust the URL based on your target platform
url: https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
dest: /tmp/miniconda.sh

- name: Install Miniconda
command: bash /tmp/miniconda.sh -b -p {{conda_vars.CONDA_DIR}}
args:
creates: {{conda_vars.CONDA_DIR}}/bin/conda # Check if Miniconda is already installed
creates: "{{conda_vars.CONDA_DIR}}/bin/conda"

- name: Add Miniconda to PATH
lineinfile:
Expand All @@ -30,48 +30,45 @@
shell: chown -R {{conda_vars.default_user}}:{{conda_vars.default_user}} {{conda_vars.CONDA_DIR}}/

- name: Add bioconda channel
become_user: "{{ conda_vars.default_user }}"
shell: timeout 1m bash -c 'source {{conda_vars.CONDA_DIR}}/bin/activate && conda config --add channels bioconda'
become_user: "{{conda_vars.default_user}}"
shell: 'timeout 1m bash -c ''source {{conda_vars.CONDA_DIR}}/bin/activate && conda config --add channels bioconda'''
args:
executable: /bin/bash

- name: Add conda-forge channel
become_user: "{{ conda_vars.default_user }}"
ansible.builtin.shell: timeout 1m bash -c 'source {{conda_vars.CONDA_DIR}}/bin/activate && conda config --add channels conda-forge'
become_user: "{{conda_vars.default_user}}"
shell: 'timeout 1m bash -c ''source {{conda_vars.CONDA_DIR}}/bin/activate && conda config --add channels conda-forge'''
args:
executable: /bin/bash

- name: Add anaconda channel
become_user: "{{ conda_vars.default_user }}"
ansible.builtin.shell: timeout 1m bash -c 'source {{conda_vars.CONDA_DIR}}/bin/activate && conda config --add channels anaconda'
become_user: "{{conda_vars.default_user}}"
shell: 'timeout 1m bash -c ''source {{conda_vars.CONDA_DIR}}/bin/activate && conda config --add channels anaconda'''
args:
executable: /bin/bash

- name: Init .bashrc for conda
become_user: "{{ conda_vars.default_user }}"
ansible.builtin.shell: timeout 1m bash -c 'source {{ conda_vars.CONDA_DIR}}/bin/activate && conda init'
become_user: "{{conda_vars.default_user}}"
shell: 'timeout 1m bash -c ''source {{ conda_vars.CONDA_DIR}}/bin/activate && conda init'''
args:
executable: /bin/bash

- name: Create alias for environment
become_user: "{{ conda_vars.default_user }}"
become_user: "{{conda_vars.default_user}}"
lineinfile:
path: /home/{{ conda_vars.default_user }}/.bashrc
line: "alias {{ conda_vars.ENV_NAME|quote }}='conda activate {{ conda_vars.ENV_NAME|quote }}'"

path: "/home/{{conda_vars.default_user}}/.bashrc"
line: "alias {{conda_vars.ENV_NAME|quote}}='conda activate {{conda_vars.ENV_NAME|quote}}'"

- name: Check for installed packages
become_user: "{{ conda_vars.default_user }}"
ansible.builtin.shell: 'source {{ conda_vars.CONDA_DIR }}/bin/activate && conda activate {{ conda_vars.ENV_NAME|quote }} && conda list'
become_user: "{{conda_vars.default_user}}"
shell: 'source {{conda_vars.CONDA_DIR}}/bin/activate && conda activate {{conda_vars.ENV_NAME|quote}} && conda list'
register: added_packages
args:
executable: /bin/bash


- name: Install chosen packages
become_user: "{{ conda_vars.default_user }}"
ansible.builtin.shell: 'source {{ conda_vars.CONDA_DIR }}/bin/activate && conda activate {{ conda_vars.ENV_NAME|quote }}
&& conda install --yes {{ item.key }}={{ item.value.version }}'
become_user: "{{conda_vars.default_user}}"
shell: 'source {{conda_vars.CONDA_DIR}}/bin/activate && conda activate {{conda_vars.ENV_NAME|quote}} && conda install --yes {{item.key}}={{item.value.version}}'

Check failure on line 71 in conda/conda.yml

View workflow job for this annotation

GitHub Actions / build

yaml[line-length]

Line too long (162 > 160 characters)
args:
executable: /bin/bash
loop: "{{ q('dict', conda_vars.packages) }}"
Expand Down

0 comments on commit 4fe5ac5

Please sign in to comment.