Commit 3147616f authored by Reimar Stier's avatar Reimar Stier

conda installer update logic

parent 40e96abb
...@@ -3,3 +3,4 @@ ...@@ -3,3 +3,4 @@
.idea/ .idea/
roles/ roles/
disks disks
*.pyc
...@@ -4,4 +4,5 @@ conda_installer_version: "latest" ...@@ -4,4 +4,5 @@ conda_installer_version: "latest"
# distribution may be either miniconda or anaconda # distribution may be either miniconda or anaconda
conda_installer_distribution: "miniconda" conda_installer_distribution: "miniconda"
conda_installer_python_version: "3" conda_installer_python_version: "3"
conda_installer_dir: "/opt" conda_installer_parent_dir: "/opt"
conda_installer_dir: "{{ conda_installer_parent_dir }}/conda"
\ No newline at end of file
...@@ -2,34 +2,45 @@ ...@@ -2,34 +2,45 @@
block: block:
- name: Download Miniconda - name: Download Miniconda
get_url: get_url:
url: "{{ conda_releases['latest']['download'] }}" url: "{{ conda_installer_version_info['download'] }}"
dest: /tmp/install-miniconda.sh dest: /tmp/install-miniconda.sh
checksum: "md5:{{ conda_releases['latest']['MD5'] }}" checksum: "md5:{{ conda_installer_version_info['MD5'] }}"
mode: 0550 mode: 0550
- name: Create conda folder - name: Create conda folder
file: file:
path: /opt/miniconda3 path: "{{ conda_installer_path }}"
state: directory state: directory
owner: vagrant owner: vagrant
mode: 755 mode: 755
recurse: true recurse: true
- name: Run the installer - name: Run the installer
shell: /tmp/install-miniconda.sh -b -u -p /opt/miniconda3 # https://docs.anaconda.com/anaconda/install/silent-mode
shell: "/tmp/install-miniconda.sh -b -u -p {{ conda_installer_path }}"
- name: Remove the installer - name: Remove the installer
file: file:
state: absent state: absent
path: /tmp/install-miniconda.sh path: /tmp/install-miniconda.sh
- name: Add miniconda bin to path - name: Add miniconda bin to path
shell: echo 'export PATH=/opt/miniconda3/bin:$PATH' >> /etc/profile lineinfile:
path: /etc/profile
regexp: '^export PATH={{ conda_installer_dir }}/bin:\$PATH$'
line: "export PATH={{ conda_installer_dir }}/bin:$PATH"
- name: conda - read permission for all - name: conda - read permission for all
file: file:
path: /opt/miniconda3 path: "{{ conda_installer_path }}"
owner: owner:
mode: +r mode: +r
recurse: true recurse: true
- name: conda - execution permission for all - name: conda - execution permission for all
file: file:
path: /opt/miniconda3/bin path: "{{ conda_installer_path }}/bin"
mode: +x mode: +x
recurse: true recurse: true
- name: conda - create symlink for base directory
file:
src: "{{ conda_installer_path }}"
dest: "{{ conda_installer_dir }}"
state: link
when: not check_conda.stat.exists when: not check_conda.stat.exists
...@@ -13,14 +13,15 @@ ...@@ -13,14 +13,15 @@
- name: Select version - name: Select version
set_fact: set_fact:
conda_installer_version_info: "{{ conda_releases[conda_installer_version] }}" conda_installer_version_info: "{{ conda_releases[conda_installer_version] | default() }}"
- name: Show selected version - name: "Show selected version, fails if version {{ conda_installer_version }} was not found"
debug: msg="{{ conda_installer_version_info }}" debug: msg="{{ conda_installer_version_info }}"
failed_when: not conda_installer_version_info
- name: Define installation directory path with version - name: Define installation directory path with version
set_fact: set_fact:
conda_installer_path: "{{ conda_installer_dir }}/{{ conda_installer_distribution }}{{ conda_installer_python_version }}" conda_installer_path: "{{ conda_installer_parent_dir }}/{{ conda_installer_distribution }}{{ conda_installer_python_version }}_{{ conda_installer_version_info['version'] }}"
- name: Check Conda installation - name: Check Conda installation
stat: stat:
...@@ -28,5 +29,5 @@ ...@@ -28,5 +29,5 @@
get_checksum: false get_checksum: false
register: check_conda register: check_conda
- debug: msg="Conda exists {{ check_conda.stat.exists }}" - debug: msg="Conda exists in {{ conda_installer_path }} is {{ check_conda.stat.exists }}"
#- import_tasks: install.yml - import_tasks: install.yml
\ No newline at end of file \ No newline at end of file
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