mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
commit
0cd3f3ce90
17 changed files with 122 additions and 83 deletions
|
@ -10,7 +10,7 @@ CWD=`pwd`
|
|||
OS=`grep ^ID= /etc/*release|cut -d= -f2`
|
||||
OS=${OS//\"/}
|
||||
MIN_RPI_KERN=4.9.59-v7+
|
||||
MIN_ANSIBLE_VER=2.6.11
|
||||
MIN_ANSIBLE_VER=2.6.12
|
||||
|
||||
if [ ! -f /etc/iiab/local_vars.yml ]; then
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
state: present
|
||||
when: is_redhat
|
||||
|
||||
- name: Install {{ iiab_download_url }}/usbmount_0.0.14.1_all.deb, missing from Debian Stretch (debian-9)
|
||||
- name: Install {{ iiab_download_url }}/usbmount_0.0.14.1_all.deb, missing from Debian Stretch (debian-9 and not raspbian-9)
|
||||
apt:
|
||||
deb: "{{ iiab_download_url }}/usbmount_0.0.14.1_all.deb"
|
||||
#timeout: "{{ download_timeout }}" # Ansible's apt module doesn't support timeout parameter; that's ok as usbmount_0.0.14.1_all.deb is only 10KB
|
||||
|
|
|
@ -9,7 +9,7 @@ kolibri_enabled: False
|
|||
kolibri_home: "{{ content_base }}/kolibri"
|
||||
|
||||
kolibri_http_port: 8009
|
||||
kolibri_url: /kolibri/
|
||||
kolibri_url: /kolibri
|
||||
kolibri_venv_path: /usr/local/kolibri
|
||||
# 2018-07-16: IIAB recommends /usr/bin but @arky says this isn't yet possible, due to pip
|
||||
kolibri_exec_path: "{{ kolibri_venv_path }}/bin/kolibri"
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
group: root
|
||||
with_items:
|
||||
- { src: 'kolibri.service.j2', dest: '/etc/systemd/system/kolibri.service', mode: '0644' }
|
||||
- { src: 'kolibri.conf.j2', dest: '/etc/apache2/sites-available/kolibri.conf', mode: '0644' }
|
||||
|
||||
- name: Enable & (Re)Start kolibri service
|
||||
systemd:
|
||||
|
@ -73,6 +74,11 @@
|
|||
daemon_reload: yes
|
||||
when: kolibri_enabled
|
||||
|
||||
# Default: http://box/kolibri
|
||||
- name: Enable http://box{{ kolibri_url }} with Apache
|
||||
command: a2ensite kolibri.conf
|
||||
when: kolibri_enabled
|
||||
|
||||
- name: Disable kolibri service
|
||||
systemd:
|
||||
name: kolibri
|
||||
|
@ -80,6 +86,16 @@
|
|||
state: stopped
|
||||
when: not kolibri_enabled
|
||||
|
||||
- name: Disable http://box{{ kolibri_url }} with Apache
|
||||
command: a2dissite kolibri.conf
|
||||
when: not kolibri_enabled
|
||||
|
||||
# {{ apache_service }} is almost always apache2
|
||||
- name: Restart {{ apache_service }}
|
||||
systemd:
|
||||
name: "{{ apache_service }}"
|
||||
state: restarted
|
||||
|
||||
- name: Add 'kolibri' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
path: "{{ iiab_ini_file }}"
|
||||
|
|
3
roles/kolibri/templates/kolibri.conf.j2
Normal file
3
roles/kolibri/templates/kolibri.conf.j2
Normal file
|
@ -0,0 +1,3 @@
|
|||
ProxyPreserveHost On
|
||||
ProxyPass {{ kolibri_url }} http://localhost:{{ kolibri_http_port }}{{ kolibri_url }}
|
||||
ProxyPassReverse {{ kolibri_url }} http://localhost:{{ kolibri_http_port }}{{ kolibri_url }}
|
|
@ -7,6 +7,7 @@ RemainAfterExit=yes
|
|||
Environment=KOLIBRI_USER={{ kolibri_user }}
|
||||
Environment=KOLIBRI_HOME={{ kolibri_home }}
|
||||
Environment=KOLIBRI_HTTP_PORT={{ kolibri_http_port }}
|
||||
Environment=KOLIBRI_URL_PATH_PREFIX={{ kolibri_url }}
|
||||
User={{ kolibri_user }}
|
||||
Group={{ apache_user }}
|
||||
ExecStart={{ kolibri_exec_path }} start
|
||||
|
|
|
@ -2,12 +2,17 @@
|
|||
Mosquitto README
|
||||
================
|
||||
|
||||
Adds the `Mosquitto <https://mosquitto.org/>`_ (`MQTT <https://mqtt.org/faq>`_) `pub-sub <https://en.wikipedia.org/wiki/Publish–subscribe_pattern>`_ broker to Internet-in-a-Box (IIAB) for educational experiments with `IoT <https://en.wikipedia.org/wiki/Internet_of_things>`_.
|
||||
Adds the `Mosquitto <https://mosquitto.org/>`_ (`MQTT <https://mqtt.org/faq>`_) `pub-sub <https://en.wikipedia.org/wiki/Publish–subscribe_pattern>`_ broker to Internet-in-a-Box (IIAB) for electronics projects and educational experiments with `IoT <https://en.wikipedia.org/wiki/Internet_of_things>`_.
|
||||
|
||||
Roughly follows this guide: https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-the-mosquitto-mqtt-messaging-broker-on-ubuntu-16-04
|
||||
|
||||
Using It
|
||||
-------
|
||||
--------
|
||||
|
||||
Prior to installing IIAB, make sure your `/etc/iiab/local_vars.yml <http://wiki.laptop.org/go/IIAB/FAQ#What_is_local_vars.yml_and_how_do_I_customize_it.3F>`_ contains::
|
||||
|
||||
mosquitto_install: True
|
||||
mosquitto_enabled: True
|
||||
|
||||
The Mosquitto service is authenticated with:
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
- { src: 'named/named-iiab.conf.j2', dest: '/etc/named-iiab.conf', mode: '0644' }
|
||||
- { src: 'named/school.local.zone.db', dest: '/var/named-iiab/', mode: '0644' }
|
||||
- { src: 'named/school.internal.zone.db', dest: '/var/named-iiab/', mode: '0644' }
|
||||
when: named_enabled and named_install
|
||||
|
||||
- name: Enable named service ({{ dns_service }}) if named_enabled
|
||||
systemd:
|
||||
|
@ -47,11 +48,17 @@
|
|||
enabled: no
|
||||
when: not named_enabled and named_install
|
||||
|
||||
- name: Install /etc/dnsmasq.conf from template, if dnsmasq_enabled
|
||||
- name: Install /etc/dnsmasq.d/iiab.conf from template, when dnsmasq_enabled and isn't Appliance
|
||||
template:
|
||||
src: network/dnsmasq.conf.j2
|
||||
dest: /etc/dnsmasq.conf
|
||||
when: dnsmasq_enabled and dnsmasq_install
|
||||
dest: /etc/dnsmasq.d/iiab.conf
|
||||
when: dnsmasq_enabled and dnsmasq_install and (iiab_network_mode != "Appliance")
|
||||
|
||||
- name: Remove /etc/dnsmasq.d/iiab.conf, when not dnsmasq_enabled or is Appliance
|
||||
file:
|
||||
path: /etc/dnsmasq.d/iiab.conf
|
||||
state: absent
|
||||
when: (not dnsmasq_enabled) or (iiab_network_mode == "Appliance")
|
||||
|
||||
- name: Enable iiab-dnsmasq systemd service, if dnsmasq_enabled
|
||||
systemd:
|
||||
|
|
54
roles/nodejs/tasks/main.yml
Normal file
54
roles/nodejs/tasks/main.yml
Normal file
|
@ -0,0 +1,54 @@
|
|||
# 2019-01-16: duplicate Node.js code unified thanks to @jvonau. It's used by:
|
||||
# roles/sugarizer/tasks/main.yml with roles/sugarizer/meta/main.yml
|
||||
# roles/nodered/tasks/main.yml with roles/nodered/meta/main.yml
|
||||
|
||||
# 2019-01-16: fyi Node.js 10.x became "LTS" on 2018-10-30 but distros are
|
||||
# holding back for now: certainly Ubuntu 18.04 and even Debian 10/Buster
|
||||
# ("testing" branch) both install Node.js 8.x (instead of 10.x). While the
|
||||
# more bleeding-edge Debian Sid ("unstable" branch) does install Node.js 10.x
|
||||
#
|
||||
# This May Change: thanks all for running "apt -a list nodejs" on Buster's
|
||||
# daily builds @ www.debian.org/devel/debian-installer/ to keep us informed!
|
||||
|
||||
- name: Set up Node.js 8.x apt sources (debuntu distros UP TO 2017)
|
||||
shell: curl -sL https://deb.nodesource.com/setup_8.x | bash -
|
||||
args:
|
||||
warn: no
|
||||
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
|
||||
# NOT NEC TO TEST FOR is_raspbian_8 OR is_raspbian_9 AS /opt/iiab/iiab/vars/<OS>.yml
|
||||
# DEFINES THESE AS SUBSETS OF is_debian_8 OR is_debian_9 (FOR NOW!)
|
||||
|
||||
- name: Install latest Node.js which includes /usr/bin/npm (debuntu distros UP TO 2017)
|
||||
package:
|
||||
name: nodejs
|
||||
# name: nodejs=8.x
|
||||
state: latest
|
||||
# state: present
|
||||
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
|
||||
|
||||
# 2018-07-14: BOTH STEPS ABOVE TAKE TIME, but Raspbian (apt offers npm
|
||||
# 1.4.21) & Debian 9 (apt offers no npm!) STILL NEED the above
|
||||
# nodesource.com approach to get a version of npm that works with Sugarizer:
|
||||
# https://github.com/iiab/iiab/issues/798#issuecomment-404324530
|
||||
#
|
||||
# MORE POSITIVELY: this nodesource.com approach (brings in npm 5.6.0 with
|
||||
# nodejs 8.11.3 for now, to any OS) would also work on Ubuntu 18.04, and
|
||||
# might even bring about a sane consistency across mainline OS's?
|
||||
#
|
||||
# BUT FOR NOW: Ubuntu 18.04's apt (approach below) brings in npm 3.5.2,
|
||||
# which appears suffic "SO FAR"? 18.04's nodejs 8.10.0 is more reassuring!
|
||||
|
||||
# CRAZY IDEA: most versions of npm can upgrade themselves to the latest
|
||||
# (6.2.0 for now) using command "npm install -g npm", if that helps us in
|
||||
# future, e.g. TK's memory issue etc? If so, be CAREFUL this puts npm
|
||||
# in /usr/local/bin on Ubuntu 18.04 -- unlike Ubuntu 16.04 and Raspbian
|
||||
# where it upgrades /usr/bin/npm in place:
|
||||
# https://askubuntu.com/questions/1036278/npm-is-incorrect-version-on-latest-ubuntu-18-04-installation
|
||||
|
||||
- name: Install latest packages nodejs and npm (debuntu distros AFTER 2017, or other distros)
|
||||
package:
|
||||
name:
|
||||
- nodejs
|
||||
- npm
|
||||
state: latest
|
||||
when: internet_available and not (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
|
|
@ -2,7 +2,7 @@
|
|||
Node-RED README
|
||||
===============
|
||||
|
||||
Adds `Node-RED <https://nodered.org/>`_ and `Node-RED Dashboard <https://flows.nodered.org/node/node-red-dashboard>`_ to Internet-in-a-Box (IIAB) for educational experiments with `IoT <https://en.wikipedia.org/wiki/Internet_of_things>`_.
|
||||
Adds `Node-RED <https://nodered.org/>`_ and `Node-RED Dashboard <https://flows.nodered.org/node/node-red-dashboard>`_ to Internet-in-a-Box (IIAB) for electronics projects and educational experiments with `IoT <https://en.wikipedia.org/wiki/Internet_of_things>`_.
|
||||
|
||||
Node-RED is a flow-based development tool for visual programming developed originally by IBM for wiring together hardware devices, APIs and online services as part of the Internet of Things. Node-RED provides a web browser-based flow editor, which can be used to create JavaScript functions.
|
||||
|
||||
|
|
3
roles/nodered/meta/main.yml
Normal file
3
roles/nodered/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
dependencies:
|
||||
- { role: nodejs, tags: ['nodejs'], when: nodered_install }
|
||||
|
|
@ -1,30 +1,5 @@
|
|||
- name: Set up Node.js 8.x apt sources (debuntu distros up to 2017)
|
||||
shell: curl -sL https://deb.nodesource.com/setup_8.x | bash -
|
||||
args:
|
||||
warn: no
|
||||
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17) and nodered_install
|
||||
# NOT NEC TO TEST FOR is_raspbian_8 OR is_raspbian_9 AS /opt/iiab/iiab/vars/<OS>.yml
|
||||
# DEFINES THESE AS SUBSETS OF is_debian_8 OR is_debian_9 (FOR NOW!)
|
||||
|
||||
- name: Install latest Node.js which includes /usr/bin/npm (debuntu distros up to 2017)
|
||||
package:
|
||||
name: nodejs
|
||||
# name: nodejs=8.x
|
||||
state: latest
|
||||
# state: present
|
||||
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17) and nodered_install
|
||||
|
||||
# 2019-01-15: WE'RE BORROWING npm INSTALLATION TRICKS FROM MID-2018 SUGARIZER:
|
||||
# https://github.com/iiab/iiab/blob/master/roles/sugarizer/tasks/main.yml#L77-L94
|
||||
|
||||
- name: Install latest packages nodejs and npm (debuntu distros after 2017, or other distros)
|
||||
package:
|
||||
name:
|
||||
- nodejs
|
||||
- npm
|
||||
state: latest
|
||||
when: internet_available and not (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17) and nodered_install
|
||||
|
||||
# 2019-01-16: @jvonau's PR #1403 moved installation of Node.js (8.x for now) &
|
||||
# npm to roles/nodejs/tasks/main.yml, triggered by roles/nodered/meta/main.yml
|
||||
|
||||
- name: 'npm install node-red packages globally: node-red, node-red-admin, node-red-dashboard'
|
||||
shell: npm install -g --unsafe-perm node-red node-red-admin node-red-dashboard
|
||||
|
@ -78,3 +53,19 @@
|
|||
enabled: yes
|
||||
state: started
|
||||
when: nodered_enabled
|
||||
|
||||
- name: Add 'nodered' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
path: "{{ iiab_ini_file }}"
|
||||
section: nodered
|
||||
option: "{{ item.option }}"
|
||||
value: "{{ item.value }}"
|
||||
with_items:
|
||||
- option: name
|
||||
value: Node-RED
|
||||
- option: description
|
||||
value: '"Node-RED is a flow-based development tool for visual programming developed originally by IBM for wiring together hardware devices, APIs and online services as part of the Internet of Things. Node-RED provides a web browser-based flow editor, which can be used to create JavaScript functions."'
|
||||
- option: nodered_install
|
||||
value: "{{ nodered_install }}"
|
||||
- option: nodered_enabled
|
||||
value: "{{ nodered_enabled }}"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
dependencies:
|
||||
- { role: mongodb, tags: ['generic','mongodb'], when: sugarizer_install }
|
||||
- { role: nodejs, tags: ['nodejs'], when: sugarizer_install }
|
||||
|
|
|
@ -60,50 +60,8 @@
|
|||
|
||||
# 3. INSTALL A GOOD VERSION OF Node.js AND npm
|
||||
|
||||
- name: Set up Node.js 8.x apt sources (debuntu distros up to 2017)
|
||||
shell: curl -sL https://deb.nodesource.com/setup_8.x | bash -
|
||||
args:
|
||||
warn: no
|
||||
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
|
||||
# NOT NEC TO TEST FOR is_raspbian_8 OR is_raspbian_9 AS /opt/iiab/iiab/vars/<OS>.yml
|
||||
# DEFINES THESE AS SUBSETS OF is_debian_8 OR is_debian_9 (FOR NOW!)
|
||||
|
||||
- name: Install latest Node.js which includes /usr/bin/npm (debuntu distros up to 2017)
|
||||
package:
|
||||
name: nodejs
|
||||
# name: nodejs=8.x
|
||||
state: latest
|
||||
# state: present
|
||||
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
|
||||
|
||||
# 2019-01-15: BORROWED BY https://github.com/iiab/iiab/blob/master/roles/nodered/tasks/main.yml#L1-L26
|
||||
|
||||
# 2018-07-14: BOTH STEPS ABOVE TAKE TIME, but Raspbian (apt offers npm
|
||||
# 1.4.21) & Debian 9 (apt offers no npm!) STILL NEED the above
|
||||
# nodesource.com approach to get a version of npm that works with Sugarizer:
|
||||
# https://github.com/iiab/iiab/issues/798#issuecomment-404324530
|
||||
#
|
||||
# MORE POSITIVELY: this nodesource.com approach (brings in npm 5.6.0 with
|
||||
# nodejs 8.11.3 for now, to any OS) would also work on Ubuntu 18.04, and
|
||||
# might even bring about a sane consistency across mainline OS's?
|
||||
#
|
||||
# BUT FOR NOW: Ubuntu 18.04's apt (approach below) brings in npm 3.5.2,
|
||||
# which appears suffic "SO FAR"? 18.04's nodejs 8.10.0 is more reassuring!
|
||||
|
||||
# CRAZY IDEA: most versions of npm can upgrade themselves to the latest
|
||||
# (6.2.0 for now) using command "npm install -g npm", if that helps us in
|
||||
# future, e.g. TK's memory issue etc? If so, be CAREFUL this puts npm
|
||||
# in /usr/local/bin on Ubuntu 18.04 -- unlike Ubuntu 16.04 and Raspbian
|
||||
# where it upgrades /usr/bin/npm in place:
|
||||
# https://askubuntu.com/questions/1036278/npm-is-incorrect-version-on-latest-ubuntu-18-04-installation
|
||||
|
||||
- name: Install latest packages nodejs and npm (debuntu distros after 2017, or other distros)
|
||||
package:
|
||||
name:
|
||||
- nodejs
|
||||
- npm
|
||||
state: latest
|
||||
when: internet_available and not (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
|
||||
# 2019-01-16: @jvonau's PR #1403 moved installation of Node.js (8.x for now) &
|
||||
# npm to roles/nodejs/tasks/main.yml, triggered by roles/sugarizer/meta/main.yml
|
||||
|
||||
|
||||
# 4. RUN "npm install" TO POPULATE ~35MB /opt/iiab/sugarizer-server/node_modules
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
CURR_VER="undefined" # Ansible version you currently have installed
|
||||
GOOD_VER="2.7.5" # For XO laptops (pip install) & CentOS (yum install rpm)
|
||||
GOOD_VER="2.7.6" # For XO laptops (pip install) & CentOS (yum install rpm)
|
||||
# On other OS's we attempt the latest from PPA, which might be more recent
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
CURR_VER="undefined" # Ansible version you currently have installed
|
||||
GOOD_VER="2.7.5" # For XO laptops (pip install) & CentOS (yum install rpm)
|
||||
GOOD_VER="2.7.6" # For XO laptops (pip install) & CentOS (yum install rpm)
|
||||
# On other OS's we attempt the latest from PPA, which might be more recent
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
CURR_VER="undefined" # Ansible version you currently have installed
|
||||
GOOD_VER="2.7.5" # For XO laptops (pip install) & CentOS (yum install rpm)
|
||||
GOOD_VER="2.7.6" # For XO laptops (pip install) & CentOS (yum install rpm)
|
||||
# On other OS's we attempt the latest from PPA, which might be more recent
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
|
Loading…
Reference in a new issue