Commit 40e96abb authored by Reimar Stier's avatar Reimar Stier

add conda install version check

parent 9fe99df8
- name: Install Conda
block:
- name: Download Miniconda
get_url:
url: "{{ conda_releases['latest']['download'] }}"
dest: /tmp/install-miniconda.sh
checksum: "md5:{{ conda_releases['latest']['MD5'] }}"
mode: 0550
- name: Create conda folder
file:
path: /opt/miniconda3
state: directory
owner: vagrant
mode: 755
recurse: true
- name: Run the installer
shell: /tmp/install-miniconda.sh -b -u -p /opt/miniconda3
- name: Remove the installer
file:
state: absent
path: /tmp/install-miniconda.sh
- name: Add miniconda bin to path
shell: echo 'export PATH=/opt/miniconda3/bin:$PATH' >> /etc/profile
- name: conda - read permission for all
file:
path: /opt/miniconda3
owner:
mode: +r
recurse: true
- name: conda - execution permission for all
file:
path: /opt/miniconda3/bin
mode: +x
recurse: true
when: not check_conda.stat.exists
...@@ -5,49 +5,28 @@ ...@@ -5,49 +5,28 @@
name: ["python-bs4", "python3-bs4"] name: ["python-bs4", "python3-bs4"]
state: present state: present
- name: Check Conda installation
stat:
path: /opt/miniconda3
get_checksum: false
register: check_conda
- name: Lookup recent version of conda - name: Lookup recent version of conda
set_fact: set_fact:
conda_releases: "{{ lookup('conda_releases', conda_installer_distribution, conda_installer_python_version) }}" conda_releases: "{{ lookup('conda_releases', conda_installer_distribution, conda_installer_python_version) }}"
- name: Show conda releases - name: Show conda releases
debug: msg="{{ conda_releases }}" debug: msg="{{ conda_releases }}"
- name: Install Conda - name: Select version
block: set_fact:
- name: Download Miniconda conda_installer_version_info: "{{ conda_releases[conda_installer_version] }}"
get_url:
url: "{{ conda_releases['latest']['download'] }}" - name: Show selected version
dest: /tmp/install-miniconda.sh debug: msg="{{ conda_installer_version_info }}"
checksum: "md5:{{ conda_releases['latest']['MD5'] }}"
mode: 0550 - name: Define installation directory path with version
- name: Create conda folder set_fact:
file: conda_installer_path: "{{ conda_installer_dir }}/{{ conda_installer_distribution }}{{ conda_installer_python_version }}"
path: /opt/miniconda3
state: directory - name: Check Conda installation
owner: vagrant stat:
mode: 755 path: "{{ conda_installer_path }}"
recurse: true get_checksum: false
- name: Run the installer register: check_conda
shell: /tmp/install-miniconda.sh -b -u -p /opt/miniconda3
- name: Remove the installer - debug: msg="Conda exists {{ check_conda.stat.exists }}"
file: #- import_tasks: install.yml
state: absent \ No newline at end of file
path: /tmp/install-miniconda.sh
- name: Add miniconda bin to path
shell: echo 'export PATH=/opt/miniconda3/bin:$PATH' >> /etc/profile
- name: conda - read permission for all
file:
path: /opt/miniconda3
owner:
mode: +r
recurse: true
- name: conda - execution permission for all
file:
path: /opt/miniconda3/bin
mode: +x
recurse: true
when: not check_conda.stat.exists
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment