Skip to content
Snippets Groups Projects
Commit 690f2d6a authored by Daniel Müller's avatar Daniel Müller :speech_balloon:
Browse files

General Update

- Lock jupyterlab to version 3.2.4
- Change venv tasks to execute as target_user
- Remove whitespaces
- Remove unneeded comments
parent f1fb94db
No related branches found
No related tags found
No related merge requests found
---
- hosts: localhost
vars:
target_user: pi
jupyter_service: true
ignore_python_version: false
pre_tasks:
- name: Check python version
fail:
msg: Python version is not supported. Set ignore_python_version to true to ignore this.
when: (not ignore_python_version) and not (ansible_python_version is version('3.7.0', '>=') and ansible_python_version is version('3.10.0', '<'))
# - name: Upgrade packages
# become: true
# apt:
# upgrade: true
# update_cache: true
# force_apt_get: true
- name: Update apt cache & install base requirements
become: true
apt:
update_cache: true
state: present
name:
- python3-pip
- python3-venv
# - libffi-dev # This is needed for jupyter on aarch64 to compile its C backend
roles:
- jupyter-lab
- ml-python-packages
- misc-applications
---
- hosts: localhost
vars:
target_user: pi
jupyter_service: true
ignore_python_version: false
pre_tasks:
- name: Check python version
fail:
msg: Python version is not supported. Set ignore_python_version to true to ignore this.
when: (not ignore_python_version) and not (ansible_python_version is version('3.7.0', '>=') and ansible_python_version is version('3.10.0', '<'))
- name: Update apt cache & install base requirements
become: true
apt:
update_cache: true
state: present
name:
- python3-pip
- python3-venv
roles:
- jupyter-lab
- ml-python-packages
- misc-applications
[Unit]
Description=Jupyter Lab
[Service]
Type=simple
PIDFile=/run/jupyter.pid
# Password: [empty string]
ExecStart=/home/{{ target_user }}/.ml-venv/bin/jupyter-lab --ip="0.0.0.0" --notebook-dir=/home/{{ target_user }}/notebooks --no-browser --NotebookApp.password='sha1:9a2d316959ac:843b251c27024afb46174ce40ce0ebebcf29217b'
User={{ target_user }}
Group={{ target_user }}
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
[Unit]
Description=Jupyter Lab
[Service]
Type=simple
PIDFile=/run/jupyter.pid
# Password: [empty string]
ExecStart=/home/{{ target_user }}/.ml-venv/bin/jupyter-lab --ip="0.0.0.0" --notebook-dir=/home/{{ target_user }}/notebooks --no-browser --NotebookApp.password='sha1:9a2d316959ac:843b251c27024afb46174ce40ce0ebebcf29217b'
User={{ target_user }}
Group={{ target_user }}
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
---
# roles/jupyter-lab
- name: Notebooks dir
file:
path: "/home/{{ target_user }}/notebooks"
state: directory
owner: "{{ target_user }}"
group: "{{ target_user }}"
- name: Install jupyter-lab
pip:
virtualenv_command: /usr/bin/python3 -m venv
virtualenv: "/home/{{ target_user }}/.ml-venv"
name: jupyterlab
state: present
- name: Install systemd service
become: true
template:
src: files/jupyter.service
dest: /etc/systemd/system/jupyter.service
mode: '0644'
when: jupyter_service
- name: Start Jupyter-Lab service
become: true
systemd:
name: jupyter
state: started
enabled: true
daemon_reload: true
when: jupyter_service
---
# roles/jupyter-lab
- name: Notebooks dir
file:
path: "/home/{{ target_user }}/notebooks"
state: directory
owner: "{{ target_user }}"
group: "{{ target_user }}"
- name: Install jupyter-lab
become: true
become_user: "{{ target_user }}"
pip:
virtualenv_command: /usr/bin/python3 -m venv
virtualenv: "/home/{{ target_user }}/.ml-venv"
name: jupyterlab==3.2.4
state: present
- name: Install systemd service
become: true
template:
src: files/jupyter.service
dest: /etc/systemd/system/jupyter.service
mode: '0644'
when: jupyter_service
- name: Start Jupyter-Lab service
become: true
systemd:
name: jupyter
state: started
enabled: true
daemon_reload: true
when: jupyter_service
---
# roles/misc-applications
- name: Install useful cli applications
become: true
apt:
name:
- neovim
- tmux
state: present
---
# roles/misc-applications
- name: Install useful cli applications
become: true
apt:
name:
- neovim
- tmux
state: present
......@@ -3,4 +3,3 @@ matplotlib==3.4.*
pandas==1.3.*
Pillow==8.4.*
scikit-learn==1.0.*
---
# roles/ml-python-packages
- name: Install dependecies
become: true
apt:
name:
- libatlas-base-dev
state: present
- name: Copy requirements.txt to remote fs
copy:
src: files/requirements.txt
dest: /tmp/ml-requirements.txt
- name: Install ml python packages
pip:
virtualenv_command: /usr/bin/python3 -m venv
requirements: /tmp/ml-requirements.txt
virtualenv: "/home/{{ target_user }}/.ml-venv"
---
# roles/ml-python-packages
- name: Install APT dependecies
become: true
apt:
name:
- libatlas-base-dev
state: present
- name: Copy requirements.txt to remote fs
copy:
src: files/requirements.txt
dest: /tmp/ml-requirements.txt
- name: Install ml python packages
become: true
become_user: "{{ target_user }}"
pip:
virtualenv_command: /usr/bin/python3 -m venv
requirements: /tmp/ml-requirements.txt
virtualenv: "/home/{{ target_user }}/.ml-venv"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment