Skip to content

Creating envs is not idempotent #27

@jdmansour

Description

@jdmansour

I am creating an environment and installing some packages. However, when I run the playbook again, it doesn't say "OK", but takes a while and says "changed". I am using state: present instead of latest and would expect it to finish quickly with "OK" when the environment already exists. Is there any way to get it to do that?

Example task:

- name: Install amalea environment
  become: yes
  conda:
    executable: /opt/tljh/user/bin/mamba
    environment: amalea
    state: present
    channels:
      - conda-forge
      - defaults
    name:
      - python=3.9.7
      - pip

Edit: it seems the culprit is that I gave the environment name, not a path. The function list_envs parses the output of conda env list --json, which only returns the paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions