diff --git a/.ansible-lint b/.ansible-lint index 7422d3f3..4901f82f 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -10,3 +10,4 @@ skip_list: - no-handler - risky-octal - args[module] + - ignore-errors diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 8ad0e24e..bfe20634 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -11,4 +11,15 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run ansible-lint - uses: ansible/ansible-lint@main + uses: ansible/ansible-lint@v24.9.2 + + - name: Check ansible-lint diff + if: failure() + uses: ansible/ansible-lint@v24.9.2 + with: + args: --fix + + - name: Check ansible lint diff and undo + if: failure() + run: | + git diff diff --git a/roles/conda_environment/tasks/main.yaml b/roles/conda_environment/tasks/main.yaml index a913b0e0..8f7ae09c 100644 --- a/roles/conda_environment/tasks/main.yaml +++ b/roles/conda_environment/tasks/main.yaml @@ -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