From 6dbe96e6888e556f6deeae62a5251405c152e47d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= <daniel.q.mueller@stud.h-da.de> Date: Thu, 20 Jan 2022 15:21:26 +0000 Subject: [PATCH] Extra optional step for jupyterlab autostart --- README.md | 3 ++- local.yml | 3 ++- roles/jupyter-lab/tasks/main.yml | 9 ++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b1eec55..60f75b4 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,9 @@ The configurable options are the following: | Variable name | Default value | Description | |:----------------------|:--------------|:------------| | target_user | pi | Setup for a specified user | -| jupyter_service | true | Setup a systemd service to autostart jupyterlab in the background | +| jupyter_service | true | Setup a systemd service for running in the background | | jupyter_start | true | Don't start jupyterlab directly | +| jupyter_autostart | true | Set the jupyterlab service to autostart | | ignore_python_version | false | Ignore the python version check (**not recommended**) | | ignore_architecture | false | Ignore the architecture check (**not recommended**) | diff --git a/local.yml b/local.yml index 177f73a..255bcff 100644 --- a/local.yml +++ b/local.yml @@ -2,9 +2,10 @@ - hosts: localhost vars: target_user: pi - jupyter_service: true ignore_python_version: false ignore_architecture: false + jupyter_service: true + jupyter_autostart: true jupyter_start: true pre_tasks: diff --git a/roles/jupyter-lab/tasks/main.yml b/roles/jupyter-lab/tasks/main.yml index 241b220..671048f 100644 --- a/roles/jupyter-lab/tasks/main.yml +++ b/roles/jupyter-lab/tasks/main.yml @@ -25,11 +25,18 @@ mode: '0644' when: jupyter_service +- name: Make systemd service autostart + become: true + file: + src: /etc/systemd/system/jupyter.service + dest: /etc/systemd/system/multi-user.target.wants/jupyter.service + state: link + when: jupyter_service and jupyter_autostart + - name: Start Jupyter-Lab service become: true systemd: name: jupyter state: started - enabled: true daemon_reload: true when: jupyter_service and jupyter_start -- GitLab