ansible-miniconda-role
ansible-miniconda-role copied to clipboard
Feature Request: Optional export miniconda/bin in the System PATH ENV variable
I'ld propose such a task (optional) added at the end of the role.
I'ld also add a re-usable ENV Var that contains the miniconda HOME (dir), for example named CONDA_HOME
:
Both together I currently set as a post_task in my playbook using (but would prefer it added to the role):
- name: Export python_conda ENV variables
copy: content="export CONDA_HOME={{miniconda_prefix}}\nexport CONDA_PYTHON=$CONDA_HOME/bin/python\nexport PATH=$CONDA_HOME/bin:$PATH\n" dest="/etc/profile.d/python_conda_exports.sh" mode=0755
Any suggestions ?
One may want to save these environment variables in his home directory like ~/.bash_profile
, and others may want to save /etc/profile/xxx
, or want not to save any environment variables.
Therefore, I would like to use the variable, such as miniconda_profile_path
or so, and save environment variables in it.
And I couldn't catch the use-case for $CONDA_HOME
and $CONDA_PYTHON
.
Could you tell me the use-case or references for these?
Therefore, I would like to use the variable, such as miniconda_profile_path or so, and save environment variables in it.
Good idea!
and in case the variable is empty or undefined, the task is skipped (idea of optional)
In our Infra we need the full path to python ($CONDA_PYTHON
) in the spark(-env.sh), so we can use pyspark (spark with python).
I also added $CONDA_HOME
that I think is more useful (because generic), possibly also for other people and use-cases.
Actually that one would suffice for me, as I can derive CONDA_PYTHON from it, directly in the spark-env config.
I'ld then create a PR including a new variable miniconda_profile_path
and if possible also add a CONDA_HOME ENV Var (or we could even make that configurable as well, but then the logic gets more complex, and we would need to introduce an extra template)
OK, I understand the user-case, it is worth to accept.
Just for your information, I found conda-build
uses CONDA_*
environment variables for some languages in https://github.com/conda/conda-build/blob/master/conda_build/config.py#L49-L67.
One may want to these languages, but not for all users, I think minimal setting with CONDA_PYTHON
is good starting point for most users.
And in CONDA_ROOT
and CONDA_PREFIX
appears in https://github.com/conda/conda/blob/master/conda/base/constants.py#L62-L69, one may want these variables, but I have no idea which one is best, make configurable could be an choice.
Thx for considering !
For now I can live with keeping this ENV task outside your/the role, so we could leave the issue open here, also in case others help us on decide on the better name for my proposed CONDA_HOME
. (It just think it's overkill to make that var. name configurable, so I'ld rather wait for proposals)
CONDA_ROOT
could be a good name (fully ok for me!), also seeing it here: http://stackoverflow.com/questions/28436769/how-to-change-default-anaconda-python-environment#comment45204896_28436769
about CONDA_PYTHON
I wouldn't set it (in the role), and besides in the link you posted (https://github.com/conda/conda-build/blob/master/conda_build/config.py#L49-L67 ) these CONDA_ vars look more like version numbers (not a path).