-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConda.yml
More file actions
100 lines (87 loc) · 2.65 KB
/
Copy pathConda.yml
File metadata and controls
100 lines (87 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
- name: Install Conda, Python, and other packages
hosts: all
vars_files:
- config.yml
remote_user: "{{ username }}"
become: true
connection: local
tasks:
- name: Add Conda repository
ansible.builtin.shell: bash /home/{{ username }}/ansible/scripts/download-conda.sh
args:
executable: /bin/bash
- name: Apt update after adding Conda repo
apt:
update_cache: yes
- name: Install Conda
apt:
name: "conda"
state: present
- name: Install Python3 and pip
ansible.builtin.apt:
name:
- python3
- python3-pip
- python3-dev
state: present
update_cache: yes
- name: Upgrade pip to latest version
ansible.builtin.pip:
name: pip
state: latest
executable: pip3
# - name: Install numpy and pandas
# ansible.builtin.pip:
# name:
# - numpy
# - pandas
# state: present
# executable: pip3
- name: Install python packages
ansible.builtin.shell:
cmd: /opt/conda/bin/conda install -y numpy pandas notebook=7
args:
executable: /bin/bash
environment:
HOME: "{{ root_path }}"
USER: "{{ username }}"
CONDA_PKGS_DIRS: "{{ root_path }}/.conda/pkgs"
CONDA_ENVS_PATH: "{{ root_path }}/.conda/envs"
become: no
- name: Verify Python installation
ansible.builtin.command:
cmd: python3 --version
register: python_version
changed_when: false
# - name: Verify numpy installation
# ansible.builtin.command:
# cmd: python3 -c "import numpy; print(f'numpy {numpy.__version__}')"
# register: numpy_version
# changed_when: false
# - name: Verify pandas installation
# ansible.builtin.command:
# cmd: python3 -c "import pandas; print(f'pandas {pandas.__version__}')"
# register: pandas_version
# changed_when: false
- name: Display installation summary
ansible.builtin.debug:
msg:
- "Installation complete!"
- "{{ python_version.stdout }}"
# - "{{ numpy_version.stdout }}"
# - "{{ pandas_version.stdout }}"
- name: Add Conda to bashrc
ansible.builtin.lineinfile:
dest: /home/{{ username }}/.bashrc
regexp: 'conda.sh'
line: 'source /opt/conda/etc/profile.d/conda.sh'
create: yes
state: present
- name: Activate conda in bashrc
ansible.builtin.lineinfile:
dest: /home/{{ username }}/.bashrc
regexp: 'conda activate base'
line: 'conda activate base'
create: yes
state: present