Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove conda environment and recreate when env updated #172

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ skip_list:
- no-handler
- risky-octal
- args[module]
- ignore-errors
13 changes: 12 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,15 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Run ansible-lint
uses: ansible/ansible-lint@main
uses: ansible/[email protected]

- name: Check ansible-lint diff
if: failure()
uses: ansible/[email protected]
with:
args: --fix

- name: Check ansible lint diff and undo
if: failure()
run: |
git diff
10 changes: 8 additions & 2 deletions roles/conda_environment/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@
mode: "0644"
register: _environment

- name: Remove existing conda environment {{ environment_path | basename | splitext | first }}
become: true
ansible.builtin.command:
cmd: "{{ miniforge_home }}/bin/mamba env remove --name {{ environment_path | basename | splitext | first }}"
ignore_errors: true
when: _environment.changed

- name: Install conda environment {{ environment_path | basename }}
become: true
ansible.builtin.command:
cmd: "{{ miniforge_home }}/bin/mamba env update -f /opt/conda-environments/{{ environment_path | basename }} --prefix {{ miniforge_home }}/envs/{{ environment_path
| basename | splitext | first }}"
cmd: "{{ miniforge_home }}/bin/mamba env create -f /opt/conda-environments/{{ environment_path | basename }} --prefix {{ miniforge_home }}/envs/{{ environment_path | basename | splitext | first }}"
when: _environment.changed
Loading