1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/jupyterhub/tasks/install.yml

70 lines
2.1 KiB
YAML
Raw Normal View History

2021-03-09 22:57:39 +00:00
- name: "Set 'nodejs_install: True' and 'nodejs_enabled: True'"
set_fact:
nodejs_install: True
nodejs_enabled: True
- name: NODEJS - run 'nodejs' role (attempt to install & enable Node.js)
include_role:
name: nodejs
- name: FAIL (STOP THE INSTALL) IF 'nodejs_installed is undefined'
fail:
2021-04-15 19:21:35 +00:00
msg: "JupyterHub install cannot proceed, as Node.js is not installed."
2021-03-09 22:57:39 +00:00
when: nodejs_installed is undefined
2021-04-15 19:21:35 +00:00
- name: Make 3 directories to hold JupyterHub config
2021-04-15 19:21:35 +00:00
file:
state: directory
path: "{{ item }}"
2021-04-15 19:21:35 +00:00
with_items:
- "{{ jupyterhub_venv }}/etc/jupyter" # /opt/iiab/jupyterhub
- "{{ jupyterhub_venv }}/etc/jupyterhub"
- "{{ jupyterhub_venv }}/etc/systemd"
2021-04-15 19:21:35 +00:00
- name: Use npm to install 'configurable-http-proxy'
2021-03-09 22:57:39 +00:00
npm:
2021-04-15 19:21:35 +00:00
name: configurable-http-proxy
global: yes
state: latest
2021-03-08 01:57:10 +00:00
- name: "pip install 7 packages into virtual environment: {{ jupyterhub_venv }} (~229 MB)"
2021-03-08 01:57:10 +00:00
pip:
name:
2021-04-15 19:21:35 +00:00
- pip
- wheel
- ipywidgets
- jupyterhub
- jupyterlab
- jupyterhub_firstuseauthenticator
- jupyterhub-systemdspawner
virtualenv: "{{ jupyterhub_venv }}" # /opt/iiab/jupyterhub
2021-03-08 01:57:10 +00:00
virtualenv_site_packages: no
virtualenv_command: python3 -m venv "{{ jupyterhub_venv }}"
#virtualenv_python: python3 # 2021-07-29: Was needed when above line was 'virtualenv_command: virtualenv' (generally for Python 2)
2021-03-08 01:57:10 +00:00
extra_args: "--no-cache-dir"
when: internet_available
2021-04-15 19:21:35 +00:00
- name: "Install from template: {{ jupyterhub_venv }}/etc/jupyterhub/jupyterhub_config.py"
2021-03-09 22:57:39 +00:00
template:
2021-04-15 19:21:35 +00:00
src: jupyterhub_config.py
dest: "{{ jupyterhub_venv }}/etc/jupyterhub/"
- name: "Install from template: /etc/systemd/system/jupyterhub.service"
template:
2021-04-15 19:21:35 +00:00
src: jupyterhub.service
dest: /etc/systemd/system/
# RECORD JupyterHub AS INSTALLED
- name: "Set 'jupyterhub_installed: True'"
set_fact:
jupyterhub_installed: True
- name: "Add 'jupyterhub_installed: True' to {{ iiab_state_file }}"
lineinfile:
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^jupyterhub_installed'
line: 'jupyterhub_installed: True'