mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
commit
3c0a12240f
13 changed files with 52 additions and 32 deletions
|
@ -124,6 +124,7 @@ if [ -f /etc/iiab/iiab.env ]; then
|
||||||
echo "Removed /etc/iiab/iiab.env effectively resetting STAGE (counter)."
|
echo "Removed /etc/iiab/iiab.env effectively resetting STAGE (counter)."
|
||||||
elif [ "$1" == "--reinstall" ]; then
|
elif [ "$1" == "--reinstall" ]; then
|
||||||
STAGE=0
|
STAGE=0
|
||||||
|
ARGS="$ARGS --extra-vars reinstall=True"
|
||||||
sed -i 's/^STAGE=.*/STAGE=0/' /etc/iiab/iiab.env
|
sed -i 's/^STAGE=.*/STAGE=0/' /etc/iiab/iiab.env
|
||||||
echo "Wrote STAGE=0 (counter) to /etc/iiab/iiab.env"
|
echo "Wrote STAGE=0 (counter) to /etc/iiab/iiab.env"
|
||||||
elif [ "$STAGE" -ge 2 ] && [ "$1" == "--debug" ]; then
|
elif [ "$STAGE" -ge 2 ] && [ "$1" == "--debug" ]; then
|
||||||
|
|
|
@ -1,2 +1,8 @@
|
||||||
|
- name: Create symlink /usr/bin/iiab-diagnostics
|
||||||
|
file:
|
||||||
|
src: "{{ iiab_dir }}/scripts/iiab-diagnostics"
|
||||||
|
dest: /usr/bin/iiab-diagnostics
|
||||||
|
state: link
|
||||||
|
|
||||||
- name: Create {{ iiab_ini_file }}
|
- name: Create {{ iiab_ini_file }}
|
||||||
include_tasks: iiab_ini.yml
|
include_tasks: iiab_ini.yml
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
# Initialize
|
# Initialize
|
||||||
|
|
||||||
- name: Create symlink /usr/bin/iiab-diagnostics
|
|
||||||
file:
|
|
||||||
src: "{{ iiab_dir }}/scripts/iiab-diagnostics"
|
|
||||||
dest: /usr/bin/iiab-diagnostics
|
|
||||||
state: link
|
|
||||||
|
|
||||||
- name: ...IS BEGINNING ============================================
|
- name: ...IS BEGINNING ============================================
|
||||||
stat:
|
stat:
|
||||||
path: "{{ iiab_env_file }}"
|
path: "{{ iiab_env_file }}"
|
||||||
|
@ -18,12 +11,10 @@
|
||||||
|
|
||||||
# We need to inialize the ini file and only write the location and version
|
# We need to inialize the ini file and only write the location and version
|
||||||
# sections once and only once to preserve the install date and git hash.
|
# sections once and only once to preserve the install date and git hash.
|
||||||
- name: Create IIAB directory structure and {{ iiab_ini_file }}, if first_run
|
- name: Create IIAB tools and {{ iiab_ini_file }}, if first_run
|
||||||
include_tasks: first_run.yml
|
include_tasks: first_run.yml
|
||||||
when: first_run | bool
|
when: first_run | bool
|
||||||
|
|
||||||
#- name: Loading computed_vars
|
|
||||||
# include_tasks: roles/0-init/tasks/computed_vars.yml
|
|
||||||
- name: Re-read local_facts.facts from /etc/ansible/facts.d
|
- name: Re-read local_facts.facts from /etc/ansible/facts.d
|
||||||
setup:
|
setup:
|
||||||
filter: ansible_local
|
filter: ansible_local
|
||||||
|
|
|
@ -6,7 +6,7 @@ This playbook adds `AzuraCast <https://azuracast.com/>`_ to Internet-in-a-Box (I
|
||||||
|
|
||||||
Please see AzuraCast's `screenshots <https://www.azuracast.com/about/screenshots.html>`_.
|
Please see AzuraCast's `screenshots <https://www.azuracast.com/about/screenshots.html>`_.
|
||||||
|
|
||||||
As of 2019-07-04, this will only run on Ubuntu 18.04, and tentatively on Debian 10 "Buster" (`#1766 <https://github.com/iiab/iiab/issues/1766>`_). Support for Raspberry Pi remains a goal for now — please if you can, consider helping us solve this critical challenge (`#1772 <https://github.com/iiab/iiab/issues/1772>`_, `AzuraCast/AzuraCast#332 <https://github.com/AzuraCast/AzuraCast/issues/332>`_).
|
As of 2019-08-04, this will only run on Ubuntu 18.04, and tentatively on Debian 10 "Buster" (`#1766 <https://github.com/iiab/iiab/issues/1766>`_). Support for Raspberry Pi remains a goal for now — please if you can, consider helping us solve this critical challenge (`#1772 <https://github.com/iiab/iiab/issues/1772>`_, `AzuraCast/AzuraCast#332 <https://github.com/AzuraCast/AzuraCast/issues/332>`_).
|
||||||
|
|
||||||
Using It
|
Using It
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
|
# 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!
|
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
|
||||||
|
|
||||||
calibreweb_version: V0.6.4 # WAS: master
|
calibreweb_version: 0.6.4 # WAS: master
|
||||||
|
|
||||||
calibreweb_venv_path: /usr/local/calibre-web
|
calibreweb_venv_path: /usr/local/calibre-web
|
||||||
calibreweb_exec_path: "{{ calibreweb_venv_path }}/cps.py"
|
calibreweb_exec_path: "{{ calibreweb_venv_path }}/cps.py"
|
||||||
|
|
|
@ -7,3 +7,4 @@
|
||||||
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
|
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
|
||||||
|
|
||||||
internetarchive_dir: '{{ iiab_base }}/internetarchive'
|
internetarchive_dir: '{{ iiab_base }}/internetarchive'
|
||||||
|
internetarchive_upgrade: False
|
||||||
|
|
|
@ -19,10 +19,12 @@
|
||||||
owner: "root"
|
owner: "root"
|
||||||
|
|
||||||
- name: Run yarn install to get needed modules (CAN TAKE ~15 MINUTES)
|
- name: Run yarn install to get needed modules (CAN TAKE ~15 MINUTES)
|
||||||
command: sudo yarn add @internetarchive/dweb-archive @internetarchive/dweb-mirror
|
command: yarn add @internetarchive/dweb-archive @internetarchive/dweb-mirror
|
||||||
args:
|
args:
|
||||||
chdir: "{{ internetarchive_dir }}"
|
chdir: "{{ internetarchive_dir }}"
|
||||||
|
creates: "{{ internetarchive_dir }}/node_modules/@internetarchive/dweb-mirror/internetarchive"
|
||||||
when: internet_available | bool
|
when: internet_available | bool
|
||||||
|
register: internetarchive_installing
|
||||||
|
|
||||||
- name: Create directory /library/archiveorg
|
- name: Create directory /library/archiveorg
|
||||||
file:
|
file:
|
||||||
|
@ -30,6 +32,11 @@
|
||||||
state: directory
|
state: directory
|
||||||
owner: "root"
|
owner: "root"
|
||||||
|
|
||||||
|
- name: Set --reinstall fact
|
||||||
|
set_fact:
|
||||||
|
internetarchive_upgrade: True
|
||||||
|
when: reinstall is defined
|
||||||
|
|
||||||
|
|
||||||
# CONFIG FILES
|
# CONFIG FILES
|
||||||
|
|
||||||
|
@ -58,7 +65,25 @@
|
||||||
when: is_debuntu and not internetarchive_enabled
|
when: is_debuntu and not internetarchive_enabled
|
||||||
|
|
||||||
|
|
||||||
# RESTART/STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
|
- name: Stop 'internetarchive' systemd service
|
||||||
|
systemd:
|
||||||
|
name: internetarchive
|
||||||
|
daemon_reload: yes
|
||||||
|
state: stopped
|
||||||
|
|
||||||
|
- name: 'Update pre-existing install: yarn upgrade'
|
||||||
|
command: yarn upgrade
|
||||||
|
args:
|
||||||
|
chdir: "{{ internetarchive_dir }}"
|
||||||
|
when: not internetarchive_installing.changed and internetarchive_upgrade
|
||||||
|
|
||||||
|
# RESTART/ENABLE SYSTEMD SERVICE
|
||||||
|
- name: Disable 'internetarchive' systemd service (if not internetarchive_enabled)
|
||||||
|
systemd:
|
||||||
|
name: internetarchive
|
||||||
|
enabled: no
|
||||||
|
when: not internetarchive_enabled
|
||||||
|
|
||||||
# with "systemctl daemon-reload" in case mongodb.service changed, etc
|
# with "systemctl daemon-reload" in case mongodb.service changed, etc
|
||||||
- name: Enable & Restart 'internetarchive' systemd service (if internetarchive_enabled)
|
- name: Enable & Restart 'internetarchive' systemd service (if internetarchive_enabled)
|
||||||
|
@ -69,14 +94,6 @@
|
||||||
state: restarted
|
state: restarted
|
||||||
when: internetarchive_enabled | bool
|
when: internetarchive_enabled | bool
|
||||||
|
|
||||||
- name: Disable & Stop 'internetarchive' systemd service (if not internetarchive_enabled)
|
|
||||||
systemd:
|
|
||||||
name: internetarchive
|
|
||||||
daemon_reload: yes
|
|
||||||
enabled: no
|
|
||||||
state: stopped
|
|
||||||
when: not internetarchive_enabled
|
|
||||||
|
|
||||||
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/archive (not just http://box:{{ internetarchive_port }})
|
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/archive (not just http://box:{{ internetarchive_port }})
|
||||||
systemd:
|
systemd:
|
||||||
name: "{{ apache_service }}" # httpd or apache2
|
name: "{{ apache_service }}" # httpd or apache2
|
||||||
|
|
|
@ -109,14 +109,15 @@
|
||||||
when: is_debuntu | bool
|
when: is_debuntu | bool
|
||||||
|
|
||||||
- name: Enable & Restart 'kiwix-serve' service
|
- name: Enable & Restart 'kiwix-serve' service
|
||||||
service:
|
systemd:
|
||||||
|
daemon_reload: yes
|
||||||
name: kiwix-serve
|
name: kiwix-serve
|
||||||
enabled: yes
|
enabled: yes
|
||||||
state: restarted
|
state: restarted
|
||||||
when: kiwix_enabled | bool
|
when: kiwix_enabled | bool
|
||||||
|
|
||||||
- name: Disable 'kiwix-serve' service
|
- name: Disable 'kiwix-serve' service
|
||||||
service:
|
systemd:
|
||||||
name: kiwix-serve
|
name: kiwix-serve
|
||||||
enabled: no
|
enabled: no
|
||||||
state: stopped
|
state: stopped
|
||||||
|
|
|
@ -5,6 +5,7 @@ After=syslog.target network.target local-fs.target
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
ExecStart={{ iiab_base }}/kiwix/bin/kiwix-serve --daemon --port {{ kiwix_port }} --nolibrarybutton --library {{ kiwix_library_xml }} --urlRootLocation={{ kiwix_url }}
|
ExecStart={{ iiab_base }}/kiwix/bin/kiwix-serve --daemon --port {{ kiwix_port }} --nolibrarybutton --library {{ kiwix_library_xml }} --urlRootLocation={{ kiwix_url }}
|
||||||
|
TimeoutStartSec=180
|
||||||
Restart=on-abort
|
Restart=on-abort
|
||||||
RestartSec=5s
|
RestartSec=5s
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
when: reserved_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2"
|
when: reserved_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2"
|
||||||
|
|
||||||
- name: Count LAN ifaces
|
- name: Count LAN ifaces
|
||||||
shell: ls /sys/class/net | grep -v -e wwlan -e ppp -e lo -e br0 -e tun -e {{ device_gw }} -e {{ ap_device }} | wc -l
|
shell: ls /sys/class/net | grep -v -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ ap_device }} | wc -l
|
||||||
register: num_lan_interfaces_result
|
register: num_lan_interfaces_result
|
||||||
|
|
||||||
- name: Calculate number of LAN interfaces including WiFi
|
- name: Calculate number of LAN interfaces including WiFi
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
|
|
||||||
# LAN - pick non WAN's
|
# LAN - pick non WAN's
|
||||||
- name: Create list of LAN (non WAN) ifaces
|
- name: Create list of LAN (non WAN) ifaces
|
||||||
shell: ls /sys/class/net | grep -v -e wwlan -e ppp -e lo -e br0 -e tun -e "br-*" -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ ap_device }}
|
shell: ls /sys/class/net | grep -v -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ ap_device }}
|
||||||
when: num_lan_interfaces != "0"
|
when: num_lan_interfaces != "0"
|
||||||
register: lan_list_result
|
register: lan_list_result
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
shell: curl -sL https://deb.nodesource.com/setup_{{ nodejs_version }} | bash -
|
shell: curl -sL https://deb.nodesource.com/setup_{{ nodejs_version }} | bash -
|
||||||
args:
|
args:
|
||||||
warn: no
|
warn: no
|
||||||
|
creates: /etc/apt/sources.list.d/nodesource.list
|
||||||
when: internet_available and is_debuntu
|
when: internet_available and is_debuntu
|
||||||
#when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
|
#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
|
# NOT NEC TO TEST FOR is_raspbian_8 OR is_raspbian_9 AS /opt/iiab/iiab/vars/<OS>.yml
|
||||||
|
|
|
@ -17,10 +17,6 @@
|
||||||
line: 'deb http://dl.yarnpkg.com/debian/ stable main'
|
line: 'deb http://dl.yarnpkg.com/debian/ stable main'
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: "Yarn | Update APT cache"
|
|
||||||
apt:
|
|
||||||
update_cache: yes
|
|
||||||
|
|
||||||
- name: "Yarn | Install"
|
- name: "Yarn | Install"
|
||||||
package:
|
package:
|
||||||
name: yarn
|
name: yarn
|
||||||
|
|
9
runrole
9
runrole
|
@ -2,8 +2,13 @@
|
||||||
|
|
||||||
INVENTORY="ansible_hosts"
|
INVENTORY="ansible_hosts"
|
||||||
PLAYBOOK="run-one-role.yml"
|
PLAYBOOK="run-one-role.yml"
|
||||||
#PLAYBOOK="iiab-stages.yml"
|
ARGS=""
|
||||||
CWD=`pwd`
|
CWD=`pwd`
|
||||||
|
if [ "$1" == "--reinstall" ]; then
|
||||||
|
ARGS="$ARGS --extra-vars reinstall=True"
|
||||||
|
shift 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $# -eq 2 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
export ANSIBLE_LOG_PATH="$2"
|
export ANSIBLE_LOG_PATH="$2"
|
||||||
else
|
else
|
||||||
|
@ -28,4 +33,4 @@ if [[ $# -eq 0 ]] ; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local -e "role_to_run=$1"
|
ansible-playbook -i $INVENTORY $PLAYBOOK ${ARGS} --connection=local -e "role_to_run=$1"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue