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

97 lines
3.2 KiB
YAML

- 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:
msg: "JupyterHub install cannot proceed, as Node.js is not installed."
when: nodejs_installed is undefined
- name: "Install package: python3-venv"
package:
name: python3-venv
state: present
- name: Make 3 directories to hold JupyterHub config
file:
state: directory
path: "{{ item }}"
with_items:
- "{{ jupyterhub_venv }}/etc/jupyter" # /opt/iiab/jupyterhub
- "{{ jupyterhub_venv }}/etc/jupyterhub"
- "{{ jupyterhub_venv }}/etc/systemd"
- name: Use npm to install 'configurable-http-proxy'
npm:
name: configurable-http-proxy
global: yes
state: latest
- name: "pip install 7 packages into virtual environment: {{ jupyterhub_venv }} (~229 MB)"
pip:
name:
- pip
- wheel
- ipywidgets
- jupyterhub
- jupyterlab
- jupyterhub_firstuseauthenticator
- jupyterhub-systemdspawner
virtualenv: "{{ jupyterhub_venv }}" # /opt/iiab/jupyterhub
virtualenv_site_packages: no
virtualenv_command: python3 -m venv "{{ jupyterhub_venv }}" # 2021-07-29: This works on RaspiOS 10, Debian 11, Ubuntu 20.04 and Mint 20 -- however if you absolutely must use the older Debian 10 -- you can work around errors "can't find Rust compiler" and "This package requires Rust >=1.41.0" if you (1) revert this line to 'virtualenv_command: virtualenv' AND (2) uncomment the line just below
#virtualenv_python: python3 # 2021-07-29: Was needed when above line was 'virtualenv_command: virtualenv' (generally for Python 2)
extra_args: "--no-cache-dir"
when: internet_available
- name: "Install from template: {{ jupyterhub_venv }}/etc/jupyterhub/jupyterhub_config.py"
template:
src: jupyterhub_config.py
dest: "{{ jupyterhub_venv }}/etc/jupyterhub/"
- name: "Install from template: /etc/systemd/system/jupyterhub.service"
template:
src: jupyterhub.service
dest: /etc/systemd/system/
- name: Fix the async bug in firseuseauthenticator
template:
src: patch_await.sh
dest: "{{ jupyterhub_venv }}/bin/patch_await.sh"
mode: 0755
- name: Transfer a python program to fetch the site_packages path
template:
src: getsite.py
dest: "{{ jupyterhub_venv }}/bin/getsite.py"
mode: 0755
- name: Now run the installed script
ansible.builtin.shell: "{{ jupyterhub_venv }}/bin/patch_await.sh"
- name: Turn off the warning about http insecurity
template:
src: patch-http-warning.sh
dest: "{{ jupyterhub_venv }}/bin/patch_http-warning.sh"
mode: 0755
- name: Now run the installed script
ansible.builtin.shell: "{{ jupyterhub_venv }}/bin/patch_http-warning.sh"
# 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'