diff --git a/roles/jupyter/tasks/enable-or-disable.yml b/roles/jupyter/tasks/enable-or-disable.yml index ad8bb17ad..becab8e9a 100644 --- a/roles/jupyter/tasks/enable-or-disable.yml +++ b/roles/jupyter/tasks/enable-or-disable.yml @@ -23,3 +23,19 @@ when: not jupyter_enabled +- name: Put the nginx config file in place + template: + src: jupyter-nginx.conf + dest: "{{ nginx_conf_dir }}/" + when: jupyter_enabled + +- name: Disable jupyterhub + file: + path: "{{ nginx_conf_dir }}/jupyter-nginx.conf" + state: absent + when: not jupyter_enabled + +- name: Restart 'nginx' systemd service + systemd: + name: nginx + state: restarted diff --git a/roles/jupyter/tasks/install.yml b/roles/jupyter/tasks/install.yml index 353f78cae..6901db83d 100644 --- a/roles/jupyter/tasks/install.yml +++ b/roles/jupyter/tasks/install.yml @@ -1,8 +1,3 @@ -- name: We need a non-privileged user to write all the notebooks - ansible.builtin.user: - name: web-user - home: /opt/iiab/notebooks - - name: Make the directories to hold jupyter config file: state: directory @@ -12,12 +7,6 @@ - '{{ jupyter_venv }}/etc/jupyterhub' - '{{ jupyter_venv }}/etc/systemd' -- name: Make a directory to hold notebooks - file: - state: directory - path: /opt/iiab/notebooks - owner: web-user - - name: "Set 'nodejs_install: True' and 'nodejs_enabled: True'" set_fact: nodejs_install: True @@ -59,6 +48,7 @@ template: src: jupyterhub_config.py dest: '{{ jupyter_venv }}/etc/jupyterhub/' + - name: Use systemd to start jupyterhub template: src: jupyter.service diff --git a/roles/jupyter/templates/jupyterhub_config.py b/roles/jupyter/templates/jupyterhub_config.py index 999715a8f..cd0999ca1 100644 --- a/roles/jupyter/templates/jupyterhub_config.py +++ b/roles/jupyter/templates/jupyterhub_config.py @@ -1057,7 +1057,7 @@ c.JupyterHub.spawner_class = 'systemdspawner.SystemdSpawner' # # Defaults to an empty set, in which case no user has admin access. # Default: set() - c.Authenticator.admin_users = set('iiab-admin') +c.Authenticator.admin_users = set('iiab-admin') ## Set of usernames that are allowed to log in. #