diff --git a/iiab-install b/iiab-install index 7d5f71c35..adbbf69b7 100755 --- a/iiab-install +++ b/iiab-install @@ -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 diff --git a/roles/0-init/tasks/first_run.yml b/roles/0-init/tasks/first_run.yml index 332da85b7..666103396 100644 --- a/roles/0-init/tasks/first_run.yml +++ b/roles/0-init/tasks/first_run.yml @@ -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 diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index 5a40bb39d..b6e4ac735 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -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 diff --git a/roles/azuracast/README.rst b/roles/azuracast/README.rst index dab20aa20..420bfb92d 100644 --- a/roles/azuracast/README.rst +++ b/roles/azuracast/README.rst @@ -6,7 +6,7 @@ This playbook adds `AzuraCast `_ to Internet-in-a-Box (I Please see AzuraCast's `screenshots `_. -As of 2019-07-04, this will only run on Ubuntu 18.04, and tentatively on Debian 10 "Buster" (`#1766 `_). Support for Raspberry Pi remains a goal for now — please if you can, consider helping us solve this critical challenge (`#1772 `_, `AzuraCast/AzuraCast#332 `_). +As of 2019-08-04, this will only run on Ubuntu 18.04, and tentatively on Debian 10 "Buster" (`#1766 `_). Support for Raspberry Pi remains a goal for now — please if you can, consider helping us solve this critical challenge (`#1772 `_, `AzuraCast/AzuraCast#332 `_). Using It -------- diff --git a/roles/calibre-web/defaults/main.yml b/roles/calibre-web/defaults/main.yml index 0515068b9..4770498ad 100644 --- a/roles/calibre-web/defaults/main.yml +++ b/roles/calibre-web/defaults/main.yml @@ -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" diff --git a/roles/internetarchive/defaults/main.yml b/roles/internetarchive/defaults/main.yml index c2b445d53..d26f839bf 100644 --- a/roles/internetarchive/defaults/main.yml +++ b/roles/internetarchive/defaults/main.yml @@ -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 diff --git a/roles/internetarchive/tasks/main.yml b/roles/internetarchive/tasks/main.yml index fd0f196d5..e6721de9f 100644 --- a/roles/internetarchive/tasks/main.yml +++ b/roles/internetarchive/tasks/main.yml @@ -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 diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 309b53530..613ee1b9a 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -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 diff --git a/roles/kiwix/templates/kiwix-serve.service.j2 b/roles/kiwix/templates/kiwix-serve.service.j2 index b4d160db4..14dc96bc8 100644 --- a/roles/kiwix/templates/kiwix-serve.service.j2 +++ b/roles/kiwix/templates/kiwix-serve.service.j2 @@ -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 diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index a05dc7581..a3198e818 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -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 diff --git a/roles/nodejs/tasks/main.yml b/roles/nodejs/tasks/main.yml index 3e504b09c..86e318a44 100644 --- a/roles/nodejs/tasks/main.yml +++ b/roles/nodejs/tasks/main.yml @@ -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/.yml diff --git a/roles/yarn/tasks/main.yml b/roles/yarn/tasks/main.yml index 170ef42ce..6edadeab0 100644 --- a/roles/yarn/tasks/main.yml +++ b/roles/yarn/tasks/main.yml @@ -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 diff --git a/runrole b/runrole index 4d060c719..8a8d72986 100755 --- a/runrole +++ b/runrole @@ -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"