diff --git a/roles/6-generic-apps/tasks/main.yml b/roles/6-generic-apps/tasks/main.yml index 7e5bc884c..d1bdc56a1 100644 --- a/roles/6-generic-apps/tasks/main.yml +++ b/roles/6-generic-apps/tasks/main.yml @@ -31,6 +31,11 @@ name: gitea when: gitea_install +- name: JUPYTERHUB + include_role: + name: jupyterhub + when: jupyterhub_install + - name: LOKOLE include_role: name: lokole diff --git a/roles/jupyterhub/docs/README.md b/roles/jupyterhub/README.md similarity index 52% rename from roles/jupyterhub/docs/README.md rename to roles/jupyterhub/README.md index 9285bfa1b..92aa09749 100644 --- a/roles/jupyterhub/docs/README.md +++ b/roles/jupyterhub/README.md @@ -1,7 +1,8 @@ -### Jupyter Notebooks on Rpi Server +### JupyterHub programming environment with student Notebooks + * Jupyter Notebooks are widely used in the scientific community. -* This IIAB package permits individal users to start using their own notebook on the server without needing an individual server account. +* This IIAB package permits individual users to start using their own notebook on the server, without needing an individual server account. * Once a user signs in with a user name, and password, these credentials are stored, and are used thereafter to gain access to the user's files. -* Individual folders are created for all student work in the path /var/lib/protected/. Individual students will only be able to see their own work in that directory. +* Individual folders are created for all student work in the path /var/lib/protected/. Individual students will only be able to see their own work in that directory. * Students will not have any privileges outside of their own folder. -* They may upload jupyter notebooks from a local machine, and download the current state of their work via a normal browser download. +* They may upload Jupyter Notebooks from a local machine, and download the current state of their work via a normal browser download. diff --git a/roles/jupyterhub/tasks/main.yml b/roles/jupyterhub/tasks/main.yml index 9090610a0..0ec1045ec 100644 --- a/roles/jupyterhub/tasks/main.yml +++ b/roles/jupyterhub/tasks/main.yml @@ -1,3 +1,24 @@ +# "How do i fail a task in Ansible if the variable contains a boolean value? +# I want to perform input validation for Ansible playbooks" +# https://stackoverflow.com/questions/46664127/how-do-i-fail-a-task-in-ansible-if-the-variable-contains-a-boolean-value-i-want/46667499#46667499 + +# We assume 0-init/tasks/validate_vars.yml has DEFINITELY been run, so no need +# to re-check whether vars are defined here. As Ansible vars cannot be unset: +# https://serverfault.com/questions/856729/how-to-destroy-delete-unset-a-variable-value-in-ansible + +- name: Assert that "jupyterhub_install is sameas true" (boolean not string etc) + assert: + that: jupyterhub_install is sameas true + fail_msg: "PLEASE SET 'jupyterhub_install: True' e.g. IN: /etc/iiab/local_vars.yml" + quiet: yes + +- name: Assert that "jupyterhub_enabled | type_debug == 'bool'" (boolean not string etc) + assert: + that: jupyterhub_enabled | type_debug == 'bool' + fail_msg: "PLEASE GIVE VARIABLE 'jupyterhub_enabled' A PROPER (UNQUOTED) ANSIBLE BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml" + quiet: yes + + - name: Install Jupyter if jupyterhub_installed not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml include_tasks: install.yml when: jupyterhub_installed is undefined @@ -14,9 +35,9 @@ value: "{{ item.value | string }}" with_items: - option: name - value: Jupyter + value: JupyterHub - option: description - value: '"Raspberry Pi Jupyter python programming environment"' + 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 experiments results and program output within their notebook/document/blog."' - option: install value: "{{ jupyterhub_install }}" - option: enabled diff --git a/roles/network/templates/gateway/iiab-gen-iptables b/roles/network/templates/gateway/iiab-gen-iptables index 95d9fea94..8380304fa 100755 --- a/roles/network/templates/gateway/iiab-gen-iptables +++ b/roles/network/templates/gateway/iiab-gen-iptables @@ -159,7 +159,7 @@ if [ "$wan" != "none" ]; then $IPTABLES -A INPUT -p tcp --dport $sugarizer_port -m state --state NEW -i $wan -j ACCEPT $IPTABLES -A INPUT -p tcp --dport $transmission_http_port -m state --state NEW -i $wan -j ACCEPT - $IPTABLES -A INPUT -p tcp --dport $transmission_http_port -m state --state NEW -i $wan -j ACCEPT + $IPTABLES -A INPUT -p tcp --dport $transmission_peer_port -m state --state NEW -i $wan -j ACCEPT $IPTABLES -A INPUT -p tcp --dport $jupyterhub_port -m state --state NEW -i $wan -j ACCEPT fi diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 853afa608..87dfd0444 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -380,6 +380,11 @@ gitea_enabled: False gitea_url: /gitea gitea_port: 61734 +# JupyterHub programming environment with student Notebooks +jupyterhub_install: False +jupyterhub_enabled: False +jupyterhub_port: 8000 + # Lokole (email for rural communities) from https://ascoderu.ca lokole_install: False lokole_enabled: False @@ -564,9 +569,6 @@ phpmyadmin_enabled: False vnstat_install: False vnstat_enabled: False -jupyterhub_install: False -jupyterhub_enabled: False -jupyterhub_port: 8000 # 9-LOCAL-ADDONS diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index 3c244b915..e9fe79195 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -253,6 +253,10 @@ elgg_enabled: True gitea_install: True gitea_enabled: True +# JupyterHub programming environment with student Notebooks +jupyterhub_install: True +jupyterhub_enabled: True + # Lokole (email for rural communities) from https://ascoderu.ca lokole_install: True lokole_enabled: True diff --git a/vars/local_vars_medium.yml b/vars/local_vars_medium.yml index 887b0a165..e201b0669 100644 --- a/vars/local_vars_medium.yml +++ b/vars/local_vars_medium.yml @@ -253,6 +253,10 @@ elgg_enabled: False gitea_install: False gitea_enabled: False +# JupyterHub programming environment with student Notebooks +jupyterhub_install: False +jupyterhub_enabled: False + # Lokole (email for rural communities) from https://ascoderu.ca lokole_install: False lokole_enabled: False diff --git a/vars/local_vars_min.yml b/vars/local_vars_min.yml index 10dab276c..db25fa66d 100644 --- a/vars/local_vars_min.yml +++ b/vars/local_vars_min.yml @@ -253,6 +253,10 @@ elgg_enabled: False gitea_install: False gitea_enabled: False +# JupyterHub programming environment with student Notebooks +jupyterhub_install: False +jupyterhub_enabled: False + # Lokole (email for rural communities) from https://ascoderu.ca lokole_install: False lokole_enabled: False