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
Branches
No related tags found
No related merge requests found
--- ---
- hosts: localhost - hosts: localhost
vars: vars:
target_user: pi target_user: pi
jupyter_service: true jupyter_service: true
ignore_python_version: false ignore_python_version: false
pre_tasks: pre_tasks:
- name: Check python version - name: Check python version
fail: fail:
msg: Python version is not supported. Set ignore_python_version to true to ignore this. 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', '<')) 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 - name: Update apt cache & install base requirements
# become: true become: true
# apt: apt:
# upgrade: true update_cache: true
# update_cache: true state: present
# force_apt_get: true name:
- python3-pip
- name: Update apt cache & install base requirements - python3-venv
become: true
apt: roles:
update_cache: true - jupyter-lab
state: present - ml-python-packages
name: - misc-applications
- 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
[Unit] [Unit]
Description=Jupyter Lab Description=Jupyter Lab
[Service] [Service]
Type=simple Type=simple
PIDFile=/run/jupyter.pid PIDFile=/run/jupyter.pid
# Password: [empty string] # 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' 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 }} User={{ target_user }}
Group={{ target_user }} Group={{ target_user }}
Restart=always Restart=always
RestartSec=10 RestartSec=10
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
--- ---
# roles/jupyter-lab # roles/jupyter-lab
- name: Notebooks dir - name: Notebooks dir
file: file:
path: "/home/{{ target_user }}/notebooks" path: "/home/{{ target_user }}/notebooks"
state: directory state: directory
owner: "{{ target_user }}" owner: "{{ target_user }}"
group: "{{ target_user }}" group: "{{ target_user }}"
- name: Install jupyter-lab - name: Install jupyter-lab
pip: become: true
virtualenv_command: /usr/bin/python3 -m venv become_user: "{{ target_user }}"
virtualenv: "/home/{{ target_user }}/.ml-venv" pip:
name: jupyterlab virtualenv_command: /usr/bin/python3 -m venv
state: present virtualenv: "/home/{{ target_user }}/.ml-venv"
name: jupyterlab==3.2.4
- name: Install systemd service state: present
become: true
template: - name: Install systemd service
src: files/jupyter.service become: true
dest: /etc/systemd/system/jupyter.service template:
mode: '0644' src: files/jupyter.service
when: jupyter_service dest: /etc/systemd/system/jupyter.service
mode: '0644'
- name: Start Jupyter-Lab service when: jupyter_service
become: true
systemd: - name: Start Jupyter-Lab service
name: jupyter become: true
state: started systemd:
enabled: true name: jupyter
daemon_reload: true state: started
when: jupyter_service enabled: true
daemon_reload: true
when: jupyter_service
--- ---
# roles/misc-applications # roles/misc-applications
- name: Install useful cli applications - name: Install useful cli applications
become: true become: true
apt: apt:
name: name:
- neovim - neovim
- tmux - tmux
state: present state: present
...@@ -3,4 +3,3 @@ matplotlib==3.4.* ...@@ -3,4 +3,3 @@ matplotlib==3.4.*
pandas==1.3.* pandas==1.3.*
Pillow==8.4.* Pillow==8.4.*
scikit-learn==1.0.* scikit-learn==1.0.*
--- ---
# roles/ml-python-packages # roles/ml-python-packages
- name: Install dependecies - name: Install APT dependecies
become: true become: true
apt: apt:
name: name:
- libatlas-base-dev - libatlas-base-dev
state: present state: present
- name: Copy requirements.txt to remote fs - name: Copy requirements.txt to remote fs
copy: copy:
src: files/requirements.txt src: files/requirements.txt
dest: /tmp/ml-requirements.txt dest: /tmp/ml-requirements.txt
- name: Install ml python packages - name: Install ml python packages
pip: become: true
virtualenv_command: /usr/bin/python3 -m venv become_user: "{{ target_user }}"
requirements: /tmp/ml-requirements.txt pip:
virtualenv: "/home/{{ target_user }}/.ml-venv" 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