1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #277 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2019-08-13 14:45:08 -04:00 committed by GitHub
commit 3c0a12240f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 52 additions and 32 deletions

View file

@ -124,6 +124,7 @@ if [ -f /etc/iiab/iiab.env ]; then
echo "Removed /etc/iiab/iiab.env effectively resetting STAGE (counter)."
elif [ "$1" == "--reinstall" ]; then
STAGE=0
ARGS="$ARGS --extra-vars reinstall=True"
sed -i 's/^STAGE=.*/STAGE=0/' /etc/iiab/iiab.env
echo "Wrote STAGE=0 (counter) to /etc/iiab/iiab.env"
elif [ "$STAGE" -ge 2 ] && [ "$1" == "--debug" ]; then

View file

@ -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 }}
include_tasks: iiab_ini.yml

View file

@ -1,11 +1,4 @@
# 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 ============================================
stat:
path: "{{ iiab_env_file }}"
@ -18,12 +11,10 @@
# 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.
- 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
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
setup:
filter: ansible_local

View file

@ -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>`_.
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
--------

View file

@ -14,7 +14,7 @@
# 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!
calibreweb_version: V0.6.4 # WAS: master
calibreweb_version: 0.6.4 # WAS: master
calibreweb_venv_path: /usr/local/calibre-web
calibreweb_exec_path: "{{ calibreweb_venv_path }}/cps.py"

View file

@ -7,3 +7,4 @@
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
internetarchive_dir: '{{ iiab_base }}/internetarchive'
internetarchive_upgrade: False

View file

@ -19,10 +19,12 @@
owner: "root"
- 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:
chdir: "{{ internetarchive_dir }}"
creates: "{{ internetarchive_dir }}/node_modules/@internetarchive/dweb-mirror/internetarchive"
when: internet_available | bool
register: internetarchive_installing
- name: Create directory /library/archiveorg
file:
@ -30,6 +32,11 @@
state: directory
owner: "root"
- name: Set --reinstall fact
set_fact:
internetarchive_upgrade: True
when: reinstall is defined
# CONFIG FILES
@ -58,7 +65,25 @@
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
- name: Enable & Restart 'internetarchive' systemd service (if internetarchive_enabled)
@ -69,14 +94,6 @@
state: restarted
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 }})
systemd:
name: "{{ apache_service }}" # httpd or apache2

View file

@ -109,14 +109,15 @@
when: is_debuntu | bool
- name: Enable & Restart 'kiwix-serve' service
service:
systemd:
daemon_reload: yes
name: kiwix-serve
enabled: yes
state: restarted
when: kiwix_enabled | bool
- name: Disable 'kiwix-serve' service
service:
systemd:
name: kiwix-serve
enabled: no
state: stopped

View file

@ -5,6 +5,7 @@ After=syslog.target network.target local-fs.target
[Service]
Type=forking
ExecStart={{ iiab_base }}/kiwix/bin/kiwix-serve --daemon --port {{ kiwix_port }} --nolibrarybutton --library {{ kiwix_library_xml }} --urlRootLocation={{ kiwix_url }}
TimeoutStartSec=180
Restart=on-abort
RestartSec=5s

View file

@ -103,7 +103,7 @@
when: reserved_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2"
- 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
- name: Calculate number of LAN interfaces including WiFi
@ -112,7 +112,7 @@
# LAN - pick non WAN's
- 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"
register: lan_list_result

View file

@ -69,6 +69,7 @@
shell: curl -sL https://deb.nodesource.com/setup_{{ nodejs_version }} | bash -
args:
warn: no
creates: /etc/apt/sources.list.d/nodesource.list
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)
# NOT NEC TO TEST FOR is_raspbian_8 OR is_raspbian_9 AS /opt/iiab/iiab/vars/<OS>.yml

View file

@ -17,10 +17,6 @@
line: 'deb http://dl.yarnpkg.com/debian/ stable main'
state: present
- name: "Yarn | Update APT cache"
apt:
update_cache: yes
- name: "Yarn | Install"
package:
name: yarn

View file

@ -2,8 +2,13 @@
INVENTORY="ansible_hosts"
PLAYBOOK="run-one-role.yml"
#PLAYBOOK="iiab-stages.yml"
ARGS=""
CWD=`pwd`
if [ "$1" == "--reinstall" ]; then
ARGS="$ARGS --extra-vars reinstall=True"
shift 1
fi
if [ $# -eq 2 ]; then
export ANSIBLE_LOG_PATH="$2"
else
@ -28,4 +33,4 @@ if [[ $# -eq 0 ]] ; then
exit 0
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"