diff --git a/README.md b/README.md index b1eec5533eff4a16ef8bad120eb262cf96eded04..60f75b4e9814f998c922fbd532e62a7fe2234855 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 177f73a21f014ecf16b9db42bbe2e393c0b64666..255bcffe7aa898c92d0b21eb47a456f2a44b2305 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 241b2208e808cce000979df2a52294c60cf611d3..671048fe4f293454c147a14a6c83dc9917648283 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