mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +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_install: False
|
||||||
jupyterhub_port: 8000
|
# 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
|
daemon_reload: yes
|
||||||
|
|
||||||
|
|
||||||
# enable or disable
|
- name: Enable & Restart jupyterhub.service
|
||||||
- name: Enable & Restart jupyterhub
|
|
||||||
systemd:
|
systemd:
|
||||||
name: "{{ item }}"
|
name: jupyterhub
|
||||||
enabled: yes
|
enabled: yes
|
||||||
state: restarted
|
state: restarted
|
||||||
with_items:
|
|
||||||
- jupyterhub.service
|
|
||||||
when: jupyterhub_enabled
|
when: jupyterhub_enabled
|
||||||
|
|
||||||
- name: Disable jupyterhub
|
- name: Disable jupyterhub.service
|
||||||
systemd:
|
systemd:
|
||||||
name: "{{ item }}"
|
name: jupyterhub
|
||||||
enabled: no
|
enabled: no
|
||||||
state: stopped
|
state: stopped
|
||||||
with_items:
|
|
||||||
- jupyterhub
|
|
||||||
when: not jupyterhub_enabled
|
when: not jupyterhub_enabled
|
||||||
|
|
||||||
|
|
||||||
- name: Put the nginx config file in place
|
- name: 'Install from template: {{ nginx_conf_dir }}/jupyterhub-nginx.conf'
|
||||||
template:
|
template:
|
||||||
src: jupyterhub-nginx.conf
|
src: jupyterhub-nginx.conf
|
||||||
dest: "{{ nginx_conf_dir }}/"
|
dest: "{{ nginx_conf_dir }}/"
|
||||||
when: jupyterhub_enabled
|
when: jupyterhub_enabled
|
||||||
|
|
||||||
- name: Disable jupyterhub
|
- name: Disable {{ nginx_conf_dir }}/jupyterhub-nginx.conf
|
||||||
file:
|
file:
|
||||||
path: "{{ nginx_conf_dir }}/jupyterhub-nginx.conf"
|
path: "{{ nginx_conf_dir }}/jupyterhub-nginx.conf"
|
||||||
state: absent
|
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'"
|
- name: "Set 'nodejs_install: True' and 'nodejs_enabled: True'"
|
||||||
set_fact:
|
set_fact:
|
||||||
nodejs_install: True
|
nodejs_install: True
|
||||||
|
@ -18,38 +9,61 @@
|
||||||
|
|
||||||
- name: FAIL (STOP THE INSTALL) IF 'nodejs_installed is undefined'
|
- name: FAIL (STOP THE INSTALL) IF 'nodejs_installed is undefined'
|
||||||
fail:
|
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
|
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:
|
pip:
|
||||||
name:
|
name:
|
||||||
- pip
|
- pip
|
||||||
- wheel
|
- wheel
|
||||||
- ipywidgets
|
- ipywidgets
|
||||||
- jupyterhub
|
- jupyterhub
|
||||||
- jupyterlab
|
- jupyterlab
|
||||||
- jupyterhub_firstuseauthenticator
|
- jupyterhub_firstuseauthenticator
|
||||||
- jupyterhub-systemdspawner
|
- jupyterhub-systemdspawner
|
||||||
virtualenv: "{{ jupyterhub_venv }}" # /opt/iiab/jupyter
|
virtualenv: "{{ jupyterhub_venv }}" # /opt/iiab/jupyter
|
||||||
virtualenv_site_packages: no
|
virtualenv_site_packages: no
|
||||||
virtualenv_command: /usr/bin/virtualenv
|
virtualenv_command: /usr/bin/virtualenv
|
||||||
virtualenv_python: python3
|
virtualenv_python: python3
|
||||||
extra_args: "--no-cache-dir"
|
extra_args: "--no-cache-dir"
|
||||||
when: internet_available
|
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:
|
template:
|
||||||
src: jupyterhub.service
|
src: jupyterhub_config.py
|
||||||
dest: /etc/systemd/system/
|
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
|
value: JupyterHub
|
||||||
- option: description
|
- 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."'
|
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 }}"
|
value: "{{ jupyterhub_install }}"
|
||||||
- option: enabled
|
- option: jupyterhub_enabled
|
||||||
value: "{{ jupyterhub_enabled }}"
|
value: "{{ jupyterhub_enabled }}"
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
location /jupyterhub {
|
location /jupyterhub {
|
||||||
proxy_pass http://127.0.0.1:8000;
|
proxy_pass http://127.0.0.1:8000;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-NginX-Proxy true;
|
proxy_set_header X-NginX-Proxy true;
|
||||||
|
|
||||||
|
|
||||||
# websocket headers
|
# websocket headers
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
|
|
@ -383,6 +383,7 @@ gitea_port: 61734
|
||||||
# JupyterHub programming environment with student Notebooks
|
# JupyterHub programming environment with student Notebooks
|
||||||
jupyterhub_install: False
|
jupyterhub_install: False
|
||||||
jupyterhub_enabled: False
|
jupyterhub_enabled: False
|
||||||
|
jupyterhub_venv: /opt/iiab/jupyterhub
|
||||||
jupyterhub_port: 8000
|
jupyterhub_port: 8000
|
||||||
|
|
||||||
# Lokole (email for rural communities) from https://ascoderu.ca
|
# Lokole (email for rural communities) from https://ascoderu.ca
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue