mirror of
https://github.com/iiab/iiab.git
synced 2025-02-14 20:22:08 +00:00
commit
96974cc2da
27 changed files with 281 additions and 6 deletions
|
@ -28,6 +28,12 @@
|
|||
when: squid_install | bool
|
||||
tags: base, squid, network, domain
|
||||
|
||||
- name: Install Bluetooth - only on Raspberry Pi
|
||||
include_role:
|
||||
name: bluetooth
|
||||
when: is_rpi | bool and bluetooth_install | bool
|
||||
tags: bluetooth
|
||||
|
||||
# NETWORK moved to the very end, after Stage 9 (9-LOCAL-ADDONS)
|
||||
# It can also be run manually using: cd /opt/iiab/iiab; ./iiab-network
|
||||
#
|
||||
|
|
11
roles/bluetooth/README.rst
Normal file
11
roles/bluetooth/README.rst
Normal file
|
@ -0,0 +1,11 @@
|
|||
================
|
||||
Bluetooth README
|
||||
================
|
||||
|
||||
This role provides two services, pan or Personal Area Network, and term, terminal emulation.
|
||||
|
||||
They may be turned on or off with iiab-bt-pan-on(off) and iiab-bt-term-on(off), respectively.
|
||||
|
||||
The terminal emulates a vt100 and operates at 115200 bps, but does not always connect reliably.
|
||||
|
||||
This role is only available for the Raspberry Pi.
|
3
roles/bluetooth/defaults/main.yml
Normal file
3
roles/bluetooth/defaults/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
bluetooth_install: False
|
||||
bluetooth_enabled: False
|
||||
bluetooth_term_enabled: False
|
4
roles/bluetooth/tasks/main.yml
Normal file
4
roles/bluetooth/tasks/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
# This is rpi only
|
||||
|
||||
- include_tasks: rpi_install.yml
|
||||
when: is_rpi and bluetooth_install
|
132
roles/bluetooth/tasks/rpi_install.yml
Normal file
132
roles/bluetooth/tasks/rpi_install.yml
Normal file
|
@ -0,0 +1,132 @@
|
|||
# This is rpi only
|
||||
|
||||
- name: "Install rpi bluetooth packages"
|
||||
package:
|
||||
name:
|
||||
- bluetooth
|
||||
- bluez
|
||||
- bluez-tools
|
||||
state: present
|
||||
|
||||
- name: Create bluetooth services
|
||||
template:
|
||||
backup: no
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
with_items:
|
||||
- { src: 'bt-agent.service.j2', dest: '/etc/systemd/system/bt-agent.service' }
|
||||
- { src: 'bt-pan.service.j2', dest: '/etc/systemd/system/bt-pan.service' }
|
||||
- { src: 'bt-term.service.j2', dest: '/etc/systemd/system/bt-term.service' }
|
||||
- { src: 'network.conf.j2', dest: '/etc/bluetooth/network.conf' }
|
||||
|
||||
- name: Create bluetooth utility scripts
|
||||
template:
|
||||
backup: no
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
with_items:
|
||||
- { src: 'iiab-bt-pan-on.j2', dest: '/usr/bin/iiab-bt-pan-on' }
|
||||
- { src: 'iiab-bt-pan-off.j2', dest: '/usr/bin/iiab-bt-pan-off' }
|
||||
- { src: 'iiab-bt-pan-discoverable-on.j2', dest: 'iiab-bt-pan-discoverable-on' }
|
||||
- { src: 'iiab-bt-term-on.j2', dest: '/usr/bin/iiab-bt-term-on' }
|
||||
- { src: 'iiab-bt-term-off.j2', dest: '/usr/bin/iiab-bt-term-off' }
|
||||
|
||||
# Bluetooth service needs /usr/lib/bluetooth/bluetoothd -C --noplugin=sap
|
||||
# Copy and patch it
|
||||
|
||||
- name: Copy the bluetooth service
|
||||
template:
|
||||
dest: /etc/systemd/system/bluetooth.service
|
||||
src: /lib/systemd/system/bluetooth.service
|
||||
|
||||
- name: Add -C --noplugin=sap to execStart of bluetooth service
|
||||
lineinfile:
|
||||
path: /etc/systemd/system/bluetooth.service
|
||||
regexp: '^ExecStart=/usr/lib/bluetooth/bluetoothd'
|
||||
line: 'ExecStart=/usr/lib/bluetooth/bluetoothd -C --noplugin=sap'
|
||||
|
||||
- name: Set discoverable not to timeout
|
||||
lineinfile:
|
||||
path: /etc/bluetooth/main.conf
|
||||
regexp: '^#DiscoverableTimeout'
|
||||
line: 'DiscoverableTimeout = 0'
|
||||
|
||||
- name: Enable & Restart 'bt-agent' service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: bluetooth
|
||||
enabled: yes
|
||||
state: restarted
|
||||
|
||||
# enable or disable bt-agent
|
||||
- name: Enable & Restart 'bt-agent' service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: bt-agent
|
||||
enabled: yes
|
||||
state: restarted
|
||||
when: bluetooth_enabled or bluetooth_term_enabled
|
||||
|
||||
- name: Disable 'bt-agent' service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: bt-agent
|
||||
enabled: no
|
||||
state: stopped
|
||||
when: not bluetooth_enabled and not bluetooth_term_enabled
|
||||
|
||||
# enable or disable bt-pan
|
||||
- name: Enable & Restart 'bt-pan' service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: bt-pan
|
||||
enabled: yes
|
||||
state: restarted
|
||||
when: bluetooth_enabled | bool
|
||||
|
||||
- name: Disable 'bt-pan' service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: bt-pan
|
||||
enabled: no
|
||||
state: stopped
|
||||
when: not bluetooth_enabled | bool
|
||||
|
||||
# enable or disable bt-term
|
||||
- name: Enable & Restart 'bt-term' service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: bt-term
|
||||
enabled: yes
|
||||
state: restarted
|
||||
when: bluetooth_term_enabled | bool
|
||||
|
||||
- name: Disable 'bt-term' service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: bt-term
|
||||
enabled: no
|
||||
state: stopped
|
||||
when: not bluetooth_term_enabled | bool
|
||||
|
||||
- name: Add 'bluetooth' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
path: "{{ iiab_ini_file }}"
|
||||
section: bluetooth
|
||||
option: "{{ item.option }}"
|
||||
value: "{{ item.value }}"
|
||||
with_items:
|
||||
- option: name
|
||||
value: Bluetooth
|
||||
- option: description
|
||||
value: '"Bluetooth services for pan and terminal."'
|
||||
- option: bluetooth_enabled
|
||||
value: "{{ bluetooth_enabled }}"
|
||||
- option: bluetooth_term_enabled
|
||||
value: "{{ bluetooth_term_enabled }}"
|
10
roles/bluetooth/templates/bt-agent.service.j2
Normal file
10
roles/bluetooth/templates/bt-agent.service.j2
Normal file
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Bluetooth Auth Agent
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
15
roles/bluetooth/templates/bt-pan.service.j2
Normal file
15
roles/bluetooth/templates/bt-pan.service.j2
Normal file
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=Bluetooth NEP PAN
|
||||
#After=br0.network
|
||||
Before=network.target
|
||||
After=network-pre.target
|
||||
Requires=network-pre.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/bt-network -s nap br0
|
||||
ExecStartPost=/usr/bin/iiab-bt-pan-discoverable-on
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
12
roles/bluetooth/templates/bt-term.service.j2
Normal file
12
roles/bluetooth/templates/bt-term.service.j2
Normal file
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=RFCOMM service
|
||||
After=bluetooth.service
|
||||
Requires=bluetooth.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/usr/bin/sdptool add SP
|
||||
ExecStartPre=/bin/hciconfig hci0 piscan
|
||||
ExecStart=/usr/bin/rfcomm watch hci0 1 getty rfcomm0 115200 vt100
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
5
roles/bluetooth/templates/iiab-bt-pan-discoverable-on.j2
Normal file
5
roles/bluetooth/templates/iiab-bt-pan-discoverable-on.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
bluetoothctl <<EOF
|
||||
discoverable on
|
||||
EOF
|
12
roles/bluetooth/templates/iiab-bt-pan-off.j2
Normal file
12
roles/bluetooth/templates/iiab-bt-pan-off.j2
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
systemctl disable bt-agent
|
||||
# for some reason this service is really slow to stop and can't do anything without bt-pan
|
||||
#systemctl stop bt-agent
|
||||
|
||||
systemctl disable bt-pan
|
||||
systemctl stop bt-pan
|
||||
|
||||
bluetoothctl <<EOF
|
||||
discoverable off
|
||||
EOF
|
11
roles/bluetooth/templates/iiab-bt-pan-on.j2
Normal file
11
roles/bluetooth/templates/iiab-bt-pan-on.j2
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
systemctl enable bt-agent
|
||||
systemctl start bt-agent
|
||||
|
||||
systemctl enable bt-pan
|
||||
systemctl start bt-pan
|
||||
|
||||
bluetoothctl <<EOF
|
||||
discoverable on
|
||||
EOF
|
4
roles/bluetooth/templates/iiab-bt-term-off.j2
Normal file
4
roles/bluetooth/templates/iiab-bt-term-off.j2
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
systemctl disable bt-term
|
||||
systemctl stop bt-term
|
4
roles/bluetooth/templates/iiab-bt-term-on.j2
Normal file
4
roles/bluetooth/templates/iiab-bt-term-on.j2
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
systemctl enable bt-term
|
||||
systemctl start bt-term
|
9
roles/bluetooth/templates/network.conf.j2
Normal file
9
roles/bluetooth/templates/network.conf.j2
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Configuration file for the network service
|
||||
|
||||
[General]
|
||||
|
||||
# Disable link encryption: default=false
|
||||
#DisableSecurity=true
|
||||
|
||||
[NAP Role]
|
||||
Interface=br0
|
|
@ -8,7 +8,7 @@
|
|||
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
|
||||
|
||||
elgg_xx: elgg
|
||||
elgg_version: 2.3.12
|
||||
elgg_version: 2.3.13
|
||||
|
||||
# elgg_mysql_password: defined in default_vars
|
||||
elgg_url: /elgg
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
# 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!
|
||||
|
||||
# Just comment out this pinning line if you want Kolibri's "latest" version, after 0.12.4's bug is resolved: https://github.com/iiab/iiab/issues/1675 https://github.com/learningequality/kolibri/issues/5664
|
||||
kolibri_version: 0.12.3
|
||||
|
||||
# Kolibri folder to store its data and configuration files.
|
||||
kolibri_home: "{{ content_base }}/kolibri" # /library/kolibri
|
||||
|
||||
|
|
|
@ -27,7 +27,16 @@
|
|||
virtualenv_site_packages: no
|
||||
state: latest
|
||||
extra_args: --no-cache-dir
|
||||
when: internet_available | bool
|
||||
when: internet_available and not (kolibri_version is defined)
|
||||
|
||||
- name: Install kolibri {{ kolibri_version }} using pip
|
||||
pip:
|
||||
name: kolibri
|
||||
virtualenv: "{{ kolibri_venv_path }}"
|
||||
virtualenv_site_packages: no
|
||||
version: "{{ kolibri_version }}"
|
||||
extra_args: --no-cache-dir
|
||||
when: internet_available and kolibri_version is defined
|
||||
|
||||
- name: Run Kolibri migrations
|
||||
shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" manage migrate
|
||||
|
|
|
@ -6,7 +6,7 @@ systemctl stop hostapd
|
|||
#systemctl stop dnsmasq
|
||||
systemctl daemon-reload
|
||||
systemctl restart dhcpcd
|
||||
systemctl restart networking
|
||||
#systemctl restart networking 6/15/2019 TFM removed
|
||||
|
||||
# Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease"
|
||||
# Set wlan0 to promiscuous when AP's OFF (for possible WiFi gateway)
|
||||
|
|
|
@ -7,7 +7,7 @@ systemctl enable hostapd
|
|||
#systemctl enable dnsmasq
|
||||
systemctl daemon-reload
|
||||
systemctl restart dhcpcd
|
||||
systemctl restart networking
|
||||
#systemctl restart networking 6/15/2019 TFM removed
|
||||
systemctl start hostapd
|
||||
systemctl start dnsmasq
|
||||
|
||||
|
|
|
@ -7,6 +7,15 @@
|
|||
tags:
|
||||
- download
|
||||
|
||||
- name: Install Ncat package
|
||||
package:
|
||||
name:
|
||||
- ncat
|
||||
state: present
|
||||
when: need_ncat | bool
|
||||
tags:
|
||||
- download
|
||||
|
||||
- name: Install ssh public keys for remote support (if openvpn_install)
|
||||
lineinfile:
|
||||
line: "{{ item.pubkey }}"
|
||||
|
|
|
@ -74,6 +74,11 @@ def main():
|
|||
print('autoudate of menu items is enabled:%s. Adding %s'%(\
|
||||
fetch_menu_json_value('autoupdate_menu'),region,))
|
||||
menus.update_menu_json(menu_ref)
|
||||
# redirect from box/maps to an installed map rather than test page
|
||||
with open('{{ vector_map_path }}/index.html','w') as fp:
|
||||
outstr = """<head> \n<meta http-equiv="refresh" content="0; URL=/osm-vector-maps/en-osm-omt_%s " />\n</head>"""%fname
|
||||
fp.write(outstr)
|
||||
|
||||
|
||||
def get_map_catalog():
|
||||
global map_catalog
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
CURR_VER="undefined" # Ansible version you currently have installed
|
||||
GOOD_VER="2.8.0" # For XO laptops (pip install) & CentOS (yum install rpm)
|
||||
GOOD_VER="2.8.1" # 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.8.0" # For XO laptops (pip install) & CentOS (yum install rpm)
|
||||
GOOD_VER="2.8.1" # 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
|
||||
|
|
|
@ -27,3 +27,4 @@ systemd_location: /lib/systemd/system
|
|||
# Upgrade OS's own Calibre to very latest:
|
||||
calibre_via_debs: True
|
||||
calibre_via_python: False
|
||||
need_ncat: True
|
||||
|
|
|
@ -88,6 +88,11 @@ reboot_to_AP: False
|
|||
# For those installing IIAB over WiFi: "reboot_to_AP: True" overrides the above
|
||||
# detection of WiFi-as-gateway, forcing "hostapd_enabled: True" regardless.
|
||||
|
||||
# Bluetooth PAN access to server
|
||||
bluetooth_install: True
|
||||
bluetooth_enabled: False
|
||||
bluetooth_term_enabled: False
|
||||
|
||||
# Gateway mode
|
||||
iiab_lan_enabled: True
|
||||
iiab_wan_enabled: True
|
||||
|
@ -188,6 +193,9 @@ openvpn_cron_enabled: False
|
|||
openvpn_server: xscenet.net
|
||||
openvpn_server_virtual_ip: 10.8.0.1
|
||||
openvpn_server_port: 1194
|
||||
# Newer versions of NMap do not include NCat which is used to announce handle
|
||||
# need_ncat is turned true by os-#.yml files that don't have ncat in nmap
|
||||
need_ncat: False
|
||||
|
||||
|
||||
# 2-COMMON
|
||||
|
|
|
@ -40,3 +40,4 @@ minetest_working_dir: /library/games/minetest
|
|||
minetest_game_dir: /library/games/minetest/games/minetest_game
|
||||
minetest_rpi_src_url: http://www.nathansalapat.com/downloads/0.4.17.1.tar.gz
|
||||
minetest_rpi_src: minetest-0.4.17.1.tar.gz
|
||||
need_ncat: True
|
||||
|
|
|
@ -29,3 +29,4 @@ systemd_location: /lib/systemd/system
|
|||
# Upgrade Ubuntu 19.x's Calibre 3.39.1+ to very latest
|
||||
calibre_via_debs: False
|
||||
calibre_via_python: True
|
||||
need_ncat: True
|
||||
|
|
Loading…
Reference in a new issue