# conda install in playbook

**URL:** <https://forum.ansible.com/t/conda-install-in-playbook/23923>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [March 9, 2017, 5:38pm UTC](https://forum.ansible.com/t/conda-install-in-playbook/23923 "2017-03-09T17:38:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dynaguy](https://avatars.discourse-cdn.com/v4/letter/d/ac91a4/32.png) [@dynaguy](https://forum.ansible.com/u/dynaguy)\
**Post date:** [March 9, 2017, 5:38pm UTC](https://forum.ansible.com/t/conda-install-in-playbook/23923/1 "2017-03-09T17:38:59Z")

</div>

Hi,  
We have few python applications need to be installed on Ubuntu 16.04. Before using Ansible, I need to:

1. Download Anaconda2-4.0.0-Linux-x86\_64.sh
2. Install Anaconda in path /opt/anaconda

`bash Anaconda2-4.0.0-Linux-x86_64.sh -b -p /opt/anaconda`

1. Get conda packages, save them in /tmp/anaconda/. For example:

`/tmp/anaconda/chaco-4.5.0-np110py27_0.tar.bz2 /tmp/anaconda/conda-4.0.7-py27_0.tar.bz2 ...`

1. Install the above packages:

`/opt/anaconda/bin/conda install /tmp/conda/*.bz2 -p /opt/anaconda`

Now I am trying to do this in Ansible. I succeeded on step 1 to 3, but failed on step 4. My playbook is:  
`

- name: Install additional Anaconda packages  
command: /opt/anaconda/bin/conda install /tmp/anaconda/\*.bz2 -p /opt/anaconda

`

Output:

`

TASK [Install additional Anaconda packages] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [192.168.123.165]: FAILED! =\> {“changed”: true, “cmd”: [“/opt/anaconda/bin/conda”, “install”, “/tmp/anaconda/_.bz2", “-p”, “/opt/anaconda”], “delta”: “0:00:03.789005”, “end”: “2017-03-09 09:34:41.225162”, “failed”: true, “rc”: 1, “start”: “2017-03-09 09:34:37.436157”, “stderr”: "Using Anaconda Cloud api site [https://api.anaconda.org](https://api.anaconda.org)\nError: Package missing in current linux-64 channels: \n - /tmp/anaconda/_.bz2\n\nYou can search for this package on [anaconda.org](http://anaconda.org) with\n\n anaconda search -t conda /tmp/anaconda/\*.bz2\n\nYou may need to install the anaconda-client command line client with\n\n conda install anaconda-client”, “stdout”: “Fetching package metadata: …\nSolving package specifications: .”, “stdout\_lines”: [“Fetching package metadata: …”, “Solving package specifications: .”], “warnings”: }  
to retry, use: --limit @/etc/ansible/test.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
192.168.123.165 : ok=1 changed=0 unreachable=0 failed=1  
`

Ｃｏｕｌｄ someone help me to tell me what is the correct way to do conda install?

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [March 10, 2017, 2:52pm UTC](https://forum.ansible.com/t/conda-install-in-playbook/23923/2 "2017-03-10T14:52:16Z")

</div>

From the output, it seams it's trying to find literal name /tmp/anaconda/\*.bz2,  
I guess the asterisk is not being expanded. It might work with the shell module or you can write it like this instead.

- name: Install additional Anaconda packages  
&nbsp;&nbsp;&nbsp;command: /opt/anaconda/bin/conda install {{ item }} -p /opt/anaconda  
&nbsp;&nbsp;&nbsp;with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- /tmp/anaconda/chaco-4.5.0-np110py27\_0.tar.bz2  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- /tmp/anaconda/conda-4.0.7-py27\_0.tar.bz2
