mirror of
https://github.com/iiab/iiab.git
synced 2025-02-14 12:12:12 +00:00
Lint for readability & maintainability
This commit is contained in:
parent
f6d42953e7
commit
eac3b86097
6 changed files with 63 additions and 48 deletions
|
@ -1,2 +1,8 @@
|
|||
jupyterhub_venv: /opt/iiab/jupyterhub
|
||||
jupyterhub_port: 8000
|
||||
# jupyterhub_install: False
|
||||
# jupyterhub_enabled: False
|
||||
|
||||
# jupyterhub_venv: /opt/iiab/jupyterhub
|
||||
# jupyterhub_port: 8000
|
||||
|
||||
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
|
||||
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
|
||||
|
|
|
@ -3,33 +3,28 @@
|
|||
daemon_reload: yes
|
||||
|
||||
|
||||
# enable or disable
|
||||
- name: Enable & Restart jupyterhub
|
||||
- name: Enable & Restart jupyterhub.service
|
||||
systemd:
|
||||
name: "{{ item }}"
|
||||
name: jupyterhub
|
||||
enabled: yes
|
||||
state: restarted
|
||||
with_items:
|
||||
- jupyterhub.service
|
||||
when: jupyterhub_enabled
|
||||
|
||||
- name: Disable jupyterhub
|
||||
- name: Disable jupyterhub.service
|
||||
systemd:
|
||||
name: "{{ item }}"
|
||||
name: jupyterhub
|
||||
enabled: no
|
||||
state: stopped
|
||||
with_items:
|
||||
- jupyterhub
|
||||
when: not jupyterhub_enabled
|
||||
|
||||
|
||||
- name: Put the nginx config file in place
|
||||
- name: 'Install from template: {{ nginx_conf_dir }}/jupyterhub-nginx.conf'
|
||||
template:
|
||||
src: jupyterhub-nginx.conf
|
||||
dest: "{{ nginx_conf_dir }}/"
|
||||
when: jupyterhub_enabled
|
||||
|
||||
- name: Disable jupyterhub
|
||||
- name: Disable {{ nginx_conf_dir }}/jupyterhub-nginx.conf
|
||||
file:
|
||||
path: "{{ nginx_conf_dir }}/jupyterhub-nginx.conf"
|
||||
state: absent
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
- name: Make the directories to hold jupyter config
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ item }}'
|
||||
with_items:
|
||||
- '{{ jupyterhub_venv }}/etc/jupyter'
|
||||
- '{{ jupyterhub_venv }}/etc/jupyterhub'
|
||||
- '{{ jupyterhub_venv }}/etc/systemd'
|
||||
|
||||
- name: "Set 'nodejs_install: True' and 'nodejs_enabled: True'"
|
||||
set_fact:
|
||||
nodejs_install: True
|
||||
|
@ -18,38 +9,61 @@
|
|||
|
||||
- name: FAIL (STOP THE INSTALL) IF 'nodejs_installed is undefined'
|
||||
fail:
|
||||
msg: "Jupyter install cannot proceed, as Node.js is not installed."
|
||||
msg: "JupyterHub install cannot proceed, as Node.js is not installed."
|
||||
when: nodejs_installed is undefined
|
||||
|
||||
- name: use npm to install configurable http proxy
|
||||
npm:
|
||||
name: configurable-http-proxy
|
||||
global: yes
|
||||
state: latest
|
||||
|
||||
- name: Use pip to install into a virtual environment
|
||||
- name: Make the directories to hold JupyterHub config
|
||||
file:
|
||||
state: directory
|
||||
path: '{{ item }}'
|
||||
with_items:
|
||||
- '{{ jupyterhub_venv }}/etc/jupyter'
|
||||
- '{{ 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: 'Use pip to install into a virtual environment: {{ jupyterhub_venv }}'
|
||||
pip:
|
||||
name:
|
||||
- pip
|
||||
- wheel
|
||||
- ipywidgets
|
||||
- jupyterhub
|
||||
- jupyterlab
|
||||
- jupyterhub_firstuseauthenticator
|
||||
- jupyterhub-systemdspawner
|
||||
- pip
|
||||
- wheel
|
||||
- ipywidgets
|
||||
- jupyterhub
|
||||
- jupyterlab
|
||||
- jupyterhub_firstuseauthenticator
|
||||
- jupyterhub-systemdspawner
|
||||
virtualenv: "{{ jupyterhub_venv }}" # /opt/iiab/jupyter
|
||||
virtualenv_site_packages: no
|
||||
virtualenv_command: /usr/bin/virtualenv
|
||||
virtualenv_python: python3
|
||||
extra_args: "--no-cache-dir"
|
||||
when: internet_available
|
||||
|
||||
- name: Install the config file for jupyterhub
|
||||
template:
|
||||
src: jupyterhub_config.py
|
||||
dest: '{{ jupyterhub_venv }}/etc/jupyterhub/'
|
||||
|
||||
- name: Use systemd to start jupyterhub
|
||||
- name: 'Install from template: {{ jupyterhub_venv }}/etc/jupyterhub/jupyterhub_config.py'
|
||||
template:
|
||||
src: jupyterhub.service
|
||||
dest: /etc/systemd/system/
|
||||
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/
|
||||
|
||||
|
||||
# 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'
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
value: JupyterHub
|
||||
- option: description
|
||||
value: '"High Schools may want to consider JupyterHub to integrate coding with dynamic interactive graphing — A New Way to Think About Programming — allowing students to integrate science experiment results and program output within their notebook/document/blog."'
|
||||
- option: install
|
||||
- option: jupyterhub_install
|
||||
value: "{{ jupyterhub_install }}"
|
||||
- option: enabled
|
||||
- option: jupyterhub_enabled
|
||||
value: "{{ jupyterhub_enabled }}"
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
location /jupyterhub {
|
||||
location /jupyterhub {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
|
||||
|
||||
# websocket headers
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
|
|
|
@ -383,6 +383,7 @@ gitea_port: 61734
|
|||
# JupyterHub programming environment with student Notebooks
|
||||
jupyterhub_install: False
|
||||
jupyterhub_enabled: False
|
||||
jupyterhub_venv: /opt/iiab/jupyterhub
|
||||
jupyterhub_port: 8000
|
||||
|
||||
# Lokole (email for rural communities) from https://ascoderu.ca
|
||||
|
|
Loading…
Reference in a new issue