From 62a8ef6d0b2d891a527ff96c1bb4f4b7ccb492e0 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 24 Nov 2017 16:57:46 +0000 Subject: [PATCH 01/82] create a script that executes at every startup --- roles/2-common/tasks/main.yml | 2 ++ roles/2-common/tasks/startup.yml | 25 +++++++++++++++++++ roles/2-common/templates/iiab-startup.service | 10 ++++++++ roles/2-common/templates/iiab-startup.sh | 7 ++++++ 4 files changed, 44 insertions(+) create mode 100644 roles/2-common/tasks/startup.yml create mode 100644 roles/2-common/templates/iiab-startup.service create mode 100644 roles/2-common/templates/iiab-startup.sh diff --git a/roles/2-common/tasks/main.yml b/roles/2-common/tasks/main.yml index 638457f5f..44cbdc41c 100644 --- a/roles/2-common/tasks/main.yml +++ b/roles/2-common/tasks/main.yml @@ -44,6 +44,8 @@ - include_tasks: udev.yml +- include_tasks: iiab-startup.yml + - name: Recording STAGE 2 HAS COMPLETED ========================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' diff --git a/roles/2-common/tasks/startup.yml b/roles/2-common/tasks/startup.yml new file mode 100644 index 000000000..076348e63 --- /dev/null +++ b/roles/2-common/tasks/startup.yml @@ -0,0 +1,25 @@ +- name: Does systemd startup service exist + stat: path="{{ systemd_location }}/iiab-startup.service" + register: startup_unit + +- name: Copy startup service to /etc/systemd/system + template: src=iiab-startup.service + dest=/etc/systemd/system/ + when: startup_unit.stat.exists is defined and not startup_unit.stat.exists + +- name: Copy startup script + template: src=iiab-startup.sh + dest=/usr/libexec/ + when: startup_unit.stat.exists is defined and not startup_unit.stat.exists + +- name: Ask systemd to recognize the changes + shell: systemctl daemon-reload + when: startup_unit.stat.exists is defined and not startup_unit.stat.exists + +- name: Restart so systemd recognizes the changes + shell: systemctl restart iiab-startup.service + when: startup_unit.stat.exists is defined and not startup_unit.stat.exists + +- name: Enable the reload service + shell: systemctl enable iiab-startup.service + when: startup_unit.stat.exists is defined and not startup_unit.stat.exists diff --git a/roles/2-common/templates/iiab-startup.service b/roles/2-common/templates/iiab-startup.service new file mode 100644 index 000000000..82db659e5 --- /dev/null +++ b/roles/2-common/templates/iiab-startup.service @@ -0,0 +1,10 @@ +[Unit] +Description=Execute startup script +After=network-online.target + +[Service] +Type=oneshot +ExecStart=/usr/libecec/iiab-startup.sh + +[Install] +WantedBy=multi-user.target diff --git a/roles/2-common/templates/iiab-startup.sh b/roles/2-common/templates/iiab-startup.sh new file mode 100644 index 000000000..09db83827 --- /dev/null +++ b/roles/2-common/templates/iiab-startup.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# put initialization that needs to happen at every startup for IIAB here + +if [ ! -f /etc/iiab/uuid ]; then + uuidgen > /etc/iiab/uuid +fi + From 29104b9f757880613c9a429774c444598b0c3438 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 24 Nov 2017 11:15:38 -0600 Subject: [PATCH 02/82] add install time option for control of AP upon reboot --- roles/network/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 77b131b71..0e51de1be 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -8,13 +8,13 @@ - network - network-discover -- name: RPi hack for AP post install via wifi so the services are right +- name: RPi - reboot to AP post install - installed via wifi so the services are ready set_fact: iiab_lan_iface: br0 iiab_wan_iface: "{{ discovered_wired_iface }}" iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}" iiab_wired_lan_iface: "" - when: is_rpi and discovered_wireless_iface is defined and discovered_wireless_iface == iiab_wan_iface + when: is_rpi and discovered_wireless_iface is defined and discovered_wireless_iface == iiab_wan_iface and reboot_to_AP is defined - include_tasks: computed_network.yml when: not installing @@ -27,7 +27,7 @@ - network - AP -- name: RPi hack for AP post install via wifi don't blow away current network +- name: RPi reboot to AP post install - installed via wifi - don't blow away current network set_fact: no_net_restart: True hostapd_enabled: False From bd5684cd104be1da05b833c5cc668a22a67b0af3 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 24 Nov 2017 12:18:23 -0600 Subject: [PATCH 03/82] dhcpd contol for iiab-hotspot-on|off --- roles/network/tasks/hostapd.yml | 2 +- roles/network/templates/network/iiab-hotspot-off | 2 ++ roles/network/templates/network/iiab-hotspot-on | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 2f8ac6c07..9a815591a 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -8,7 +8,7 @@ - name: Create a config template for hostapd template: src=hostapd/iiab-hostapd.conf.j2 - dest=/etc/hostapd/hostapd.conf.template + dest=/etc/hostapd/hostapd.conf.iiab owner=root group=root mode=0644 diff --git a/roles/network/templates/network/iiab-hotspot-off b/roles/network/templates/network/iiab-hotspot-off index ca266dcb5..3f187a21e 100755 --- a/roles/network/templates/network/iiab-hotspot-off +++ b/roles/network/templates/network/iiab-hotspot-off @@ -2,6 +2,8 @@ sed -i -e "s/^denyinterfaces*/#denyinterfaces/" /etc/dhcpcd.conf systemctl disable hostapd systemctl stop hostapd +systemctl disable dhcpd +systemctl stop dhcpd systemctl daemon-reload systemctl restart dhcpcd systemctl restart networking diff --git a/roles/network/templates/network/iiab-hotspot-on b/roles/network/templates/network/iiab-hotspot-on index 0f1310110..7ab35962a 100755 --- a/roles/network/templates/network/iiab-hotspot-on +++ b/roles/network/templates/network/iiab-hotspot-on @@ -1,7 +1,10 @@ #!/bin/bash +cp -f /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf sed -i -e "s/#denyinterfaces*/denyinterfaces/" /etc/dhcpcd.conf systemctl enable hostapd +systemctl enable dhcpd systemctl daemon-reload systemctl restart dhcpcd systemctl restart networking systemctl start hostapd +systemctl start dhcpd From 7936b5b23ea4ae01487d152fdbdc9bed33953434 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Sat, 25 Nov 2017 01:25:55 +0000 Subject: [PATCH 04/82] smoketest fixes --- roles/2-common/tasks/{startup.yml => iiab-startup.yml} | 1 + roles/2-common/templates/iiab-startup.service | 2 +- roles/2-common/templates/iiab-startup.sh | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) rename roles/2-common/tasks/{startup.yml => iiab-startup.yml} (97%) diff --git a/roles/2-common/tasks/startup.yml b/roles/2-common/tasks/iiab-startup.yml similarity index 97% rename from roles/2-common/tasks/startup.yml rename to roles/2-common/tasks/iiab-startup.yml index 076348e63..fa0e60d2c 100644 --- a/roles/2-common/tasks/startup.yml +++ b/roles/2-common/tasks/iiab-startup.yml @@ -10,6 +10,7 @@ - name: Copy startup script template: src=iiab-startup.sh dest=/usr/libexec/ + mode=0755 when: startup_unit.stat.exists is defined and not startup_unit.stat.exists - name: Ask systemd to recognize the changes diff --git a/roles/2-common/templates/iiab-startup.service b/roles/2-common/templates/iiab-startup.service index 82db659e5..6e9490466 100644 --- a/roles/2-common/templates/iiab-startup.service +++ b/roles/2-common/templates/iiab-startup.service @@ -4,7 +4,7 @@ After=network-online.target [Service] Type=oneshot -ExecStart=/usr/libecec/iiab-startup.sh +ExecStart=/usr/libexec/iiab-startup.sh [Install] WantedBy=multi-user.target diff --git a/roles/2-common/templates/iiab-startup.sh b/roles/2-common/templates/iiab-startup.sh index 09db83827..afb2c1d98 100644 --- a/roles/2-common/templates/iiab-startup.sh +++ b/roles/2-common/templates/iiab-startup.sh @@ -4,4 +4,5 @@ if [ ! -f /etc/iiab/uuid ]; then uuidgen > /etc/iiab/uuid fi +exit 0 From 4c18f746dca7c7eeb3eaeee40c7a8088814be2d6 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 25 Nov 2017 11:57:55 -0600 Subject: [PATCH 05/82] guard against losing dns lookups when the machine has alreay been configured in which /etc/resolv.conf would contain 127.0.0.1 as the nameserver address with resolvconf in action and /etc/iiab/iiab.env absent --- roles/network/tasks/named.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/network/tasks/named.yml b/roles/network/tasks/named.yml index be351cd23..bfeaa7c16 100644 --- a/roles/network/tasks/named.yml +++ b/roles/network/tasks/named.yml @@ -90,3 +90,6 @@ file: path=/etc/{{ apache_config_dir }}/dns-jail.conf state=absent when: not is_debuntu and not dns_jail_enabled + +- name: Start named after copying files + service: name={{ dns_service }} state=started From 535abb5c24d5ecf60dfb8e98723ecefeffe49df8 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 09:04:07 -0500 Subject: [PATCH 06/82] kiwix/defaults/main.yml modernized & more readable --- roles/kiwix/defaults/main.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index a7b50dec1..fb45fc6c3 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -1,11 +1,20 @@ -# The following 2 lines don't work as of Nov 2017: +# Which kiwix-tools to download from http://download.iiab.io/packages/ (origin: http://download.kiwix.org/nightly/) +kiwix_src_file_linux64: "kiwix-tools_linux64_2017-11-12.tar.gz" +kiwix_src_file_armhf: "kiwix-tools_armhf_2017-11-12.tar.gz" + +# The following 2 lines are unused as of Nov 2017: # kiwix_url: /kiwix # kiwix_path: "{{ iiab_base }}/kiwix" kiwix_port: 3000 + +# /library/zims contains 3 important things: {library.xml, content, index} iiab_zim_path: "{{ content_base }}/zims" kiwix_library_xml: "{{ iiab_zim_path }}/library.xml" kiwix_content_path: "{{ iiab_zim_path }}/content" + +# Installation variables kiwix_install: True kiwix_enabled: True -kiwix_content_found: False +# The following line is unused as of Nov 2017: +# kiwix_content_found: False kiwix_first_pass: False From 5cc73404fa311d7239b0fe8651aee9d33b5c099b Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 09:20:01 -0500 Subject: [PATCH 07/82] Experimental i686 support Improvements expected before Feb 2018 @ bhttps://github.com/kiwix/kiwix-build/issues/94 --- roles/kiwix/defaults/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index fb45fc6c3..fa6cfdbc1 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -1,6 +1,9 @@ # Which kiwix-tools to download from http://download.iiab.io/packages/ (origin: http://download.kiwix.org/nightly/) kiwix_src_file_linux64: "kiwix-tools_linux64_2017-11-12.tar.gz" kiwix_src_file_armhf: "kiwix-tools_armhf_2017-11-12.tar.gz" +# Experimental as of Nov 2017: +kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" +# kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2" # The following 2 lines are unused as of Nov 2017: # kiwix_url: /kiwix From 7d6ae546f7df6b6a74cd2e4a2f8148e7f43ddcf0 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 09:27:28 -0500 Subject: [PATCH 08/82] Clarified experimental i686 kiwix-0.10 from Oct 2016 --- roles/kiwix/defaults/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index fa6cfdbc1..4f0d4597b 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -1,8 +1,9 @@ # Which kiwix-tools to download from http://download.iiab.io/packages/ (origin: http://download.kiwix.org/nightly/) kiwix_src_file_linux64: "kiwix-tools_linux64_2017-11-12.tar.gz" kiwix_src_file_armhf: "kiwix-tools_armhf_2017-11-12.tar.gz" -# Experimental as of Nov 2017: +# Experimental kiwix-0.10 from Oct 2016: (to be replaced before Feb 2018, SEE https://github.com/kiwix/kiwix-build/issues/94) kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" +# Appears to be kiwix-0.9 from May 2014: # kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2" # The following 2 lines are unused as of Nov 2017: From 7952de4332f77d51fb41131e3fcc5e1a76cb00b5 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 11:12:29 -0500 Subject: [PATCH 09/82] explanation fixed from /opt to /etc/iiab/iiab.ini --- roles/kiwix/tasks/kiwix_install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index a3a078860..fb8309bf1 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -71,7 +71,7 @@ state: directory # EXPERIMENTAL i686 CODE PATH -- name: move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (not bin_only, i.e. i686) +- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (not bin_only, i.e. i686) shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/" when: not kiwix_src_bin_only and kiwix_first_pass @@ -149,7 +149,7 @@ state: stopped when: not kiwix_enabled -- name: Add 'kiwix-serve' to list of services at /opt/iiab/iiab.ini +- name: Add 'kiwix-serve' to list of services at /etc/iiab/iiab.ini ini_file: dest: "{{ service_filelist }}" section: kiwix-serve From 42657c6bbf59ccef0e25a5e9561b2c848c91ab68 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 11:29:56 -0500 Subject: [PATCH 10/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index fb8309bf1..106f9c6cb 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -7,7 +7,7 @@ state: directory with_items: - "{{ iiab_zim_path }}" - - "{{ kiwix_content_path }}" + - "{{ iiab_zim_path }}/content" - "{{ iiab_zim_path }}/index" - name: Check for /library/zims/library.xml @@ -103,10 +103,13 @@ - rewrite when: is_debuntu -# workaround because kiwix-serve does not stay running +# In the past kiwix-serve did not stay running, so we'd been doing this hourly. +# @mgautierfr & others suggest kiwix-serve might be auto-restarted w/o cron in +# future, whenever service fails, if this really catches all cases? +# https://github.com/iiab/iiab/issues/484#issuecomment-342151726 - name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu) -# * * * * * user-name command to be executed lineinfile: + # m h d m day-of-week[Sunday=0] username command-to-be-executed line: "0 4 * * * root /bin/systemctl restart kiwix-serve.service" dest: /etc/crontab when: is_debuntu @@ -171,7 +174,8 @@ value: "{{ iiab_zim_path }}" - option: kiwix_library_xml value: "{{ kiwix_library_xml }}" - - option: kiwix_content_path - value: "{{ kiwix_content_path }}" +# The following 2 lines are unused as of Nov 2017: +# - option: kiwix_content_path +# value: "{{ kiwix_content_path }}" - option: enabled value: "{{ kiwix_enabled }}" From 3223711730290e952cbb4ef6c1b9f43045d98c2a Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 11:30:06 -0500 Subject: [PATCH 11/82] Update main.yml --- roles/kiwix/defaults/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index 4f0d4597b..e545f6ee4 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -14,11 +14,12 @@ kiwix_port: 3000 # /library/zims contains 3 important things: {library.xml, content, index} iiab_zim_path: "{{ content_base }}/zims" kiwix_library_xml: "{{ iiab_zim_path }}/library.xml" -kiwix_content_path: "{{ iiab_zim_path }}/content" +# Unused as of Nov 2017: +# kiwix_content_path: "{{ iiab_zim_path }}/content" # Installation variables kiwix_install: True kiwix_enabled: True -# The following line is unused as of Nov 2017: +# Unused as of Nov 2017: # kiwix_content_found: False kiwix_first_pass: False From dde40202783a8acb46eac617d13d09c0d07fa62a Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 11:31:17 -0500 Subject: [PATCH 12/82] Update main.yml --- roles/kiwix/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index e545f6ee4..5319c8812 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -20,6 +20,6 @@ kiwix_library_xml: "{{ iiab_zim_path }}/library.xml" # Installation variables kiwix_install: True kiwix_enabled: True +kiwix_first_pass: False # Unused as of Nov 2017: # kiwix_content_found: False -kiwix_first_pass: False From 324781d51d817170a67ec0bfc5ab539b4df91bdd Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 11:58:58 -0500 Subject: [PATCH 13/82] re-ordered & documentation brightened --- roles/kiwix/tasks/kiwix_install.yml | 97 ++++++++++++++++------------- 1 file changed, 52 insertions(+), 45 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 106f9c6cb..73101d39b 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -1,3 +1,5 @@ +# 1. CREATE/VERIFY CRITICAL DIRECTORIES & FILES ARE IN PLACE + - name: Create various directories for Kiwix's ZIM files file: path: "{{ item }}" @@ -37,7 +39,7 @@ kiwix_first_pass: True when: kiwix_bin.stat.exists is defined and not kiwix_bin.stat.exists -- name: Copy test.zim file +- name: Copy test.zim file if 1st pass copy: src: test.zim dest: "{{ kiwix_content_path }}/test.zim" @@ -47,13 +49,29 @@ force: no when: kiwix_first_pass -# We get a whole web server for i686 but only the kiwix execs for linux64 & armhf +- name: Create /opt/iiab/kiwix/bin directory + file: + path: "{{ iiab_base }}/kiwix/bin" + owner: root + group: root + mode: 0755 + state: directory + +# 2. INSTALL KIWIX-TOOLS EXECUTABLES: we get a whole web server for i686 but only the kiwix execs for linux64 & armhf + +- name: Unarchive Kiwix to permanent location if 1st pass (bin_only, i.e. not i686) + unarchive: + src: "{{ downloads_dir }}/{{ kiwix_src_file }}" + dest: "{{ iiab_base }}/kiwix/bin" + owner: root + group: root + when: kiwix_src_bin_only and kiwix_first_pass # EXPERIMENTAL i686 CODE PATH: as of Nov 2017 bunzip2 then untar unpacks # to /tmp/kiwix-0.10-i686/bin WHOSE CONTENTS NEEDS TO BE MOVED TO # /opt/iiab/kiwix/bin (STANZA FURTHER BELOW). All i686 code needs testing. # ALSO: code below may need to be revived to chown -R root:root & chmod -- name: Unarchive kiwix-*-linux-i686.tar.bz2 to /tmp (not bin_only, i.e. i686) +- name: Unarchive kiwix-*-linux-i686.tar.bz2 to /tmp if 1st pass (not bin_only, i.e. i686) unarchive: src: "{{ downloads_dir }}/{{ kiwix_src_file }}" dest: /tmp @@ -62,27 +80,11 @@ group: root when: not kiwix_src_bin_only and kiwix_first_pass -- name: Create kiwix/bin directory - file: - path: "{{ iiab_base }}/kiwix/bin" - owner: root - group: root - mode: 0755 - state: directory - # EXPERIMENTAL i686 CODE PATH -- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (not bin_only, i.e. i686) +- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin if 1st pass (not bin_only, i.e. i686) shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/" when: not kiwix_src_bin_only and kiwix_first_pass -- name: Unarchive Kiwix to permanent location (bin_only, i.e. not i686) - unarchive: - src: "{{ downloads_dir }}/{{ kiwix_src_file }}" - dest: "{{ iiab_base }}/kiwix/bin" - owner: root - group: root - when: kiwix_src_bin_only and kiwix_first_pass - # MIGHT BE RESTORED LATER FOR i686? Unused as of Nov 2017: # # workaround because unarchive does not set ownership properly # - name: "Set ownership as if: 'chown -R root:root /opt/iiab/kiwix'" @@ -93,6 +95,8 @@ # recurse: yes # mode: ???? +# 3. ENABLE MODS FOR APACHE PROXY + - name: Enable the mods which permit Apache to proxy (debuntu) apache2_module: name: "{{ item }}" @@ -103,25 +107,7 @@ - rewrite when: is_debuntu -# In the past kiwix-serve did not stay running, so we'd been doing this hourly. -# @mgautierfr & others suggest kiwix-serve might be auto-restarted w/o cron in -# future, whenever service fails, if this really catches all cases? -# https://github.com/iiab/iiab/issues/484#issuecomment-342151726 -- name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu) - lineinfile: - # m h d m day-of-week[Sunday=0] username command-to-be-executed - line: "0 4 * * * root /bin/systemctl restart kiwix-serve.service" - dest: /etc/crontab - when: is_debuntu - -- name: Make a crontab entry to restart kiwix-serve at 4AM (redhat) -# * * * * * user-name command to be executed - lineinfile: - line: "0 4 * * * root /usr/bin/systemctl restart kiwix-serve.service" - dest: /etc/crontab - when: is_redhat - -# Create Kiwix service +# 4. CREATE/ENABLE/DISABLE KIWIX SERVICE & ITS CRON JOB - name: Create 'kiwix-serve' service template: @@ -138,6 +124,13 @@ - { src: 'iiab-make-kiwix-lib.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755'} - { src: 'iiab-make-apache-config.py', dest: '/usr/bin/iiab-make-apache-config.py', mode: '0755'} +- name: Disable 'kiwix-serve' service + service: + name: kiwix-serve + enabled: no + state: stopped + when: not kiwix_enabled + - name: Enable 'kiwix-serve' service service: name: kiwix-serve @@ -145,12 +138,26 @@ state: restarted when: kiwix_enabled -- name: Disable 'kiwix-serve' service - service: - name: kiwix-serve - enabled: no - state: stopped - when: not kiwix_enabled +# In the past kiwix-serve did not stay running, so we'd been doing this hourly. +# @mgautierfr & others suggest kiwix-serve might be auto-restarted w/o cron in +# future, whenever service fails, if this really catches all cases? +# https://github.com/iiab/iiab/issues/484#issuecomment-342151726 +- name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu) + lineinfile: + # mn hr dy mo day-of-week[Sunday=0] username command-to-be-executed + line: "0 4 * * * root /bin/systemctl restart kiwix-serve.service" + dest: /etc/crontab + when: kiwix_enabled and is_debuntu + +- name: Make a crontab entry to restart kiwix-serve at 4AM (redhat) +# * * * * * user-name command to be executed + lineinfile: + # mn hr dy mo day-of-week[Sunday=0] username command-to-be-executed + line: "0 4 * * * root /usr/bin/systemctl restart kiwix-serve.service" + dest: /etc/crontab + when: kiwix_enabled and is_redhat + +# 5. FINALIZE - name: Add 'kiwix-serve' to list of services at /etc/iiab/iiab.ini ini_file: From 2f59c60325033562d0a974e93de95cd10dedecc0 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 12:04:45 -0500 Subject: [PATCH 14/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 73101d39b..6eb8b5607 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -57,7 +57,7 @@ mode: 0755 state: directory -# 2. INSTALL KIWIX-TOOLS EXECUTABLES: we get a whole web server for i686 but only the kiwix execs for linux64 & armhf +# 2. INSTALL KIWIX-TOOLS EXECUTABLES IF 1ST PASS: we get a whole web server for i686 but only the kiwix execs for linux64 & armhf - name: Unarchive Kiwix to permanent location if 1st pass (bin_only, i.e. not i686) unarchive: @@ -95,7 +95,7 @@ # recurse: yes # mode: ???? -# 3. ENABLE MODS FOR APACHE PROXY +# 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU - name: Enable the mods which permit Apache to proxy (debuntu) apache2_module: From fb6d707c127aaba27e5bf89f1c7600f665f48de8 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 12:09:47 -0500 Subject: [PATCH 15/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 6eb8b5607..c9e558601 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -42,7 +42,7 @@ - name: Copy test.zim file if 1st pass copy: src: test.zim - dest: "{{ kiwix_content_path }}/test.zim" + dest: "{{ iiab_zim_path }}/content/test.zim" mode: 0644 owner: root group: root From 19c1d2a9f3c7249c99e05f30277c0dee89b48882 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 12:10:54 -0500 Subject: [PATCH 16/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index c9e558601..cf72519a7 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -1,6 +1,6 @@ # 1. CREATE/VERIFY CRITICAL DIRECTORIES & FILES ARE IN PLACE -- name: Create various directories for Kiwix's ZIM files +- name: Create various directories for Kiwix ZIM files file: path: "{{ item }}" owner: root From 2934c91784143016877b9e2f5b38299b7d071ee8 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 12:19:16 -0500 Subject: [PATCH 17/82] kiwix_first_pass -> kiwix_force_install --- roles/kiwix/tasks/kiwix_install.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index cf72519a7..8599268dd 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -34,12 +34,12 @@ path: "{{ iiab_base }}/kiwix/bin/kiwix-serve" register: kiwix_bin -- name: Set kiwix_first_pass if kiwix-serve not found +- name: Set kiwix_force_install if kiwix-serve not found set_fact: - kiwix_first_pass: True + kiwix_force_install: True when: kiwix_bin.stat.exists is defined and not kiwix_bin.stat.exists -- name: Copy test.zim file if 1st pass +- name: Copy test.zim file if kiwix_force_install copy: src: test.zim dest: "{{ iiab_zim_path }}/content/test.zim" @@ -47,7 +47,7 @@ owner: root group: root force: no - when: kiwix_first_pass + when: kiwix_force_install - name: Create /opt/iiab/kiwix/bin directory file: @@ -57,33 +57,33 @@ mode: 0755 state: directory -# 2. INSTALL KIWIX-TOOLS EXECUTABLES IF 1ST PASS: we get a whole web server for i686 but only the kiwix execs for linux64 & armhf +# 2. INSTALL KIWIX-TOOLS EXECUTABLES IF kiwix_force_install: we get a whole web server for i686 but only the kiwix execs for linux64 & armhf -- name: Unarchive Kiwix to permanent location if 1st pass (bin_only, i.e. not i686) +- name: Unarchive Kiwix to permanent location (bin_only, i.e. not i686) unarchive: src: "{{ downloads_dir }}/{{ kiwix_src_file }}" dest: "{{ iiab_base }}/kiwix/bin" owner: root group: root - when: kiwix_src_bin_only and kiwix_first_pass + when: kiwix_src_bin_only and kiwix_force_install # EXPERIMENTAL i686 CODE PATH: as of Nov 2017 bunzip2 then untar unpacks # to /tmp/kiwix-0.10-i686/bin WHOSE CONTENTS NEEDS TO BE MOVED TO # /opt/iiab/kiwix/bin (STANZA FURTHER BELOW). All i686 code needs testing. # ALSO: code below may need to be revived to chown -R root:root & chmod -- name: Unarchive kiwix-*-linux-i686.tar.bz2 to /tmp if 1st pass (not bin_only, i.e. i686) +- name: Unarchive kiwix-*-linux-i686.tar.bz2 to /tmp (not bin_only, i.e. i686) unarchive: src: "{{ downloads_dir }}/{{ kiwix_src_file }}" dest: /tmp # dest: "{{ iiab_base }}" owner: root group: root - when: not kiwix_src_bin_only and kiwix_first_pass + when: not kiwix_src_bin_only and kiwix_force_install # EXPERIMENTAL i686 CODE PATH -- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin if 1st pass (not bin_only, i.e. i686) +- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (not bin_only, i.e. i686) shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/" - when: not kiwix_src_bin_only and kiwix_first_pass + when: not kiwix_src_bin_only and kiwix_force_install # MIGHT BE RESTORED LATER FOR i686? Unused as of Nov 2017: # # workaround because unarchive does not set ownership properly @@ -94,6 +94,7 @@ # group: root # recurse: yes # mode: ???? +# when: kiwix_force_install # 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU From 46a1a936f6e6d378f7e1cc9e7b535caba21ff7e5 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 12:31:53 -0500 Subject: [PATCH 18/82] Update main.yml --- roles/kiwix/defaults/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index 5319c8812..b2ac7bb55 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -20,6 +20,7 @@ kiwix_library_xml: "{{ iiab_zim_path }}/library.xml" # Installation variables kiwix_install: True kiwix_enabled: True -kiwix_first_pass: False +# Move file /opt/iiab/kiwix/bin/kiwix-serve if you want to force a reinstall +kiwix_force_install: False # Unused as of Nov 2017: # kiwix_content_found: False From 9c78f51b5592d8fc37034f2b28bb6defcfa58d63 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 12:37:42 -0500 Subject: [PATCH 19/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 8599268dd..5967f363d 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -57,7 +57,8 @@ mode: 0755 state: directory -# 2. INSTALL KIWIX-TOOLS EXECUTABLES IF kiwix_force_install: we get a whole web server for i686 but only the kiwix execs for linux64 & armhf +# 2. INSTALL KIWIX-TOOLS EXECUTABLES IF kiwix_force_install +# (We get a whole web server for i686 but only kiwix execs for linux64 & armhf) - name: Unarchive Kiwix to permanent location (bin_only, i.e. not i686) unarchive: From 6d201f4545ab58e722b5dbe6a8bc3e4e91b56ab8 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 12:52:48 -0500 Subject: [PATCH 20/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 5967f363d..7c598b461 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -72,7 +72,7 @@ # to /tmp/kiwix-0.10-i686/bin WHOSE CONTENTS NEEDS TO BE MOVED TO # /opt/iiab/kiwix/bin (STANZA FURTHER BELOW). All i686 code needs testing. # ALSO: code below may need to be revived to chown -R root:root & chmod -- name: Unarchive kiwix-*-linux-i686.tar.bz2 to /tmp (not bin_only, i.e. i686) +- name: Unarchive kiwix*i686.tar.bz2 to /tmp (not bin_only, i.e. i686) unarchive: src: "{{ downloads_dir }}/{{ kiwix_src_file }}" dest: /tmp From 7c06a7e20abcfe8f35d87481e75fac3e34fb7f34 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 13:02:35 -0500 Subject: [PATCH 21/82] explain how to force i686 test on x86_64 (successful!) --- roles/kiwix/tasks/main.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/roles/kiwix/tasks/main.yml b/roles/kiwix/tasks/main.yml index b0f745adf..d55284ff1 100644 --- a/roles/kiwix/tasks/main.yml +++ b/roles/kiwix/tasks/main.yml @@ -1,21 +1,21 @@ -# EXPERIMENTAL i686 CODE PATH -- name: "Set Kiwix filename to d/l: {{ kiwix_src_file_i686 }} (i686)" +- name: "Set Kiwix filename to d/l: {{ kiwix_src_file_armhf }} (armv6l or armv71)" set_fact: - kiwix_src_file: "{{ kiwix_src_file_i686 }}" - kiwix_src_bin_only: False - when: ansible_machine == "i686" - + kiwix_src_file: "{{ kiwix_src_file_armhf }}" + kiwix_src_bin_only: True + when: ansible_machine == "armv7l" or ansible_machine == "armv6l" + - name: "Set Kiwix filename to d/l: {{ kiwix_src_file_linux64 }} (x86_64)" set_fact: kiwix_src_file: "{{ kiwix_src_file_linux64 }}" kiwix_src_bin_only: True when: ansible_machine == "x86_64" -- name: "Set Kiwix filename to d/l: {{ kiwix_src_file_armhf }} (armv6l or armv71)" +- name: "Set Kiwix filename to d/l: {{ kiwix_src_file_i686 }} (i686)" set_fact: - kiwix_src_file: "{{ kiwix_src_file_armhf }}" - kiwix_src_bin_only: True - when: ansible_machine == "armv7l" or ansible_machine == "armv6l" + kiwix_src_file: "{{ kiwix_src_file_i686 }}" + kiwix_src_bin_only: False + when: ansible_machine == "i686" +# COMMENT OUT LINE ABOVE TO TEST OF i686 CODE PATH ON X86_64 (WORKS NOV 2017) - name: Download Kiwix software to /opt/iiab/downloads get_url: From eac542ff44d1331eb484425d9bae36311ab2b3fc Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 13:03:11 -0500 Subject: [PATCH 22/82] Update main.yml --- roles/kiwix/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kiwix/tasks/main.yml b/roles/kiwix/tasks/main.yml index d55284ff1..a12a82ece 100644 --- a/roles/kiwix/tasks/main.yml +++ b/roles/kiwix/tasks/main.yml @@ -15,7 +15,7 @@ kiwix_src_file: "{{ kiwix_src_file_i686 }}" kiwix_src_bin_only: False when: ansible_machine == "i686" -# COMMENT OUT LINE ABOVE TO TEST OF i686 CODE PATH ON X86_64 (WORKS NOV 2017) +# COMMENT OUT LINE ABOVE TO TEST i686 CODE PATH ON X86_64 (WORKS NOV 2017) - name: Download Kiwix software to /opt/iiab/downloads get_url: From 388603c0722bee246118b5bb7279411ce2419630 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 15:36:12 -0500 Subject: [PATCH 23/82] stale comments removed (chown tested as unnec) --- roles/kiwix/tasks/kiwix_install.yml | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 7c598b461..28f20a615 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -60,7 +60,7 @@ # 2. INSTALL KIWIX-TOOLS EXECUTABLES IF kiwix_force_install # (We get a whole web server for i686 but only kiwix execs for linux64 & armhf) -- name: Unarchive Kiwix to permanent location (bin_only, i.e. not i686) +- name: Unarchive Kiwix to permanent location (bin_only, i.e. NOT i686) unarchive: src: "{{ downloads_dir }}/{{ kiwix_src_file }}" dest: "{{ iiab_base }}/kiwix/bin" @@ -68,11 +68,7 @@ group: root when: kiwix_src_bin_only and kiwix_force_install -# EXPERIMENTAL i686 CODE PATH: as of Nov 2017 bunzip2 then untar unpacks -# to /tmp/kiwix-0.10-i686/bin WHOSE CONTENTS NEEDS TO BE MOVED TO -# /opt/iiab/kiwix/bin (STANZA FURTHER BELOW). All i686 code needs testing. -# ALSO: code below may need to be revived to chown -R root:root & chmod -- name: Unarchive kiwix*i686.tar.bz2 to /tmp (not bin_only, i.e. i686) +- name: Unarchive kiwix*i686.tar.bz2 to /tmp (NOT bin_only, i.e. i686) unarchive: src: "{{ downloads_dir }}/{{ kiwix_src_file }}" dest: /tmp @@ -81,22 +77,10 @@ group: root when: not kiwix_src_bin_only and kiwix_force_install -# EXPERIMENTAL i686 CODE PATH -- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (not bin_only, i.e. i686) +- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (NOT bin_only, i.e. i686) shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/" when: not kiwix_src_bin_only and kiwix_force_install -# MIGHT BE RESTORED LATER FOR i686? Unused as of Nov 2017: -# # workaround because unarchive does not set ownership properly -# - name: "Set ownership as if: 'chown -R root:root /opt/iiab/kiwix'" -# file: -# path: "{{ iiab_base }}/kiwix" -# owner: root -# group: root -# recurse: yes -# mode: ???? -# when: kiwix_force_install - # 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU - name: Enable the mods which permit Apache to proxy (debuntu) From c7a35c5502f84e16947507696c05905ed8820470 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 15:37:55 -0500 Subject: [PATCH 24/82] Update main.yml --- roles/kiwix/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index b2ac7bb55..37b282bef 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -6,7 +6,7 @@ kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" # Appears to be kiwix-0.9 from May 2014: # kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2" -# The following 2 lines are unused as of Nov 2017: +# The following 2 lines are unused: (Nov 2017) # kiwix_url: /kiwix # kiwix_path: "{{ iiab_base }}/kiwix" kiwix_port: 3000 From c02ef95c31e1abd55681564615f090d15703bcca Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 15:38:33 -0500 Subject: [PATCH 25/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 28f20a615..6acff9fcf 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -156,7 +156,7 @@ value: kiwix-serve - option: description value: '"Part of https://github.com/kiwix/kiwix-tools/ - kiwix-serve is the most used web server for ZIM files."' -# The following 4 lines are unused as of Nov 2017: +# The following 4 lines are unused: (Nov 2017) # - option: kiwix_url # value: "{{ kiwix_url }}" # - option: kiwix_path @@ -167,7 +167,7 @@ value: "{{ iiab_zim_path }}" - option: kiwix_library_xml value: "{{ kiwix_library_xml }}" -# The following 2 lines are unused as of Nov 2017: +# The following 2 lines are unused: (Nov 2017) # - option: kiwix_content_path # value: "{{ kiwix_content_path }}" - option: enabled From 2822b3c302ee788aaa7e4d6388d87fa5b029fe02 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 15:49:13 -0500 Subject: [PATCH 26/82] Update main.yml --- roles/kiwix/defaults/main.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index 37b282bef..3bb711c68 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -3,24 +3,27 @@ kiwix_src_file_linux64: "kiwix-tools_linux64_2017-11-12.tar.gz" kiwix_src_file_armhf: "kiwix-tools_armhf_2017-11-12.tar.gz" # Experimental kiwix-0.10 from Oct 2016: (to be replaced before Feb 2018, SEE https://github.com/kiwix/kiwix-build/issues/94) kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" -# Appears to be kiwix-0.9 from May 2014: +# Also consider kiwix-0.9 from May 2014: (during content testing!) # kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2" +kiwix_port: 3000 # The following 2 lines are unused: (Nov 2017) # kiwix_url: /kiwix # kiwix_path: "{{ iiab_base }}/kiwix" -kiwix_port: 3000 -# /library/zims contains 3 important things: {library.xml, content, index} +# /library/zims contains 3 important things: +# - library.xml +# - content directory for all *.zim's +# - index directory for legacy *.zim.idx's iiab_zim_path: "{{ content_base }}/zims" kiwix_library_xml: "{{ iiab_zim_path }}/library.xml" -# Unused as of Nov 2017: +# Unused: (Nov 2017) # kiwix_content_path: "{{ iiab_zim_path }}/content" -# Installation variables +# Installation Variables kiwix_install: True kiwix_enabled: True -# Move file /opt/iiab/kiwix/bin/kiwix-serve if you want to force a reinstall +# MOVE FILE /opt/iiab/kiwix/bin/kiwix-serve TO FORCE A REINSTALL OF kiwix-tools kiwix_force_install: False -# Unused as of Nov 2017: +# Unused: (Nov 2017) # kiwix_content_found: False From e7e7680bede627c0139799d38c58924b933cb3ed Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 16:03:52 -0500 Subject: [PATCH 27/82] Update main.yml --- roles/kiwix/defaults/main.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index 3bb711c68..556431ceb 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -1,10 +1,9 @@ # Which kiwix-tools to download from http://download.iiab.io/packages/ (origin: http://download.kiwix.org/nightly/) -kiwix_src_file_linux64: "kiwix-tools_linux64_2017-11-12.tar.gz" kiwix_src_file_armhf: "kiwix-tools_armhf_2017-11-12.tar.gz" -# Experimental kiwix-0.10 from Oct 2016: (to be replaced before Feb 2018, SEE https://github.com/kiwix/kiwix-build/issues/94) -kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" -# Also consider kiwix-0.9 from May 2014: (during content testing!) -# kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2" +kiwix_src_file_linux64: "kiwix-tools_linux64_2017-11-12.tar.gz" +kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" # Published Oct 2016 ("experimental") +# kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2" # Published May 2014 ("use v0.9 to test legacy ZIM content") +# KIWIX FOR i686 SHOULD BE REPLACED BEFORE FEB 2018: https://github.com/kiwix/kiwix-build/issues/94 kiwix_port: 3000 # The following 2 lines are unused: (Nov 2017) From 771dda2db85993abb47696f88df3788fec19220e Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 16:05:26 -0500 Subject: [PATCH 28/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 6acff9fcf..9b7cf8f32 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -126,7 +126,7 @@ # In the past kiwix-serve did not stay running, so we'd been doing this hourly. # @mgautierfr & others suggest kiwix-serve might be auto-restarted w/o cron in -# future, whenever service fails, if this really catches all cases? +# future, whenever service fails, if this really catches all cases?? # https://github.com/iiab/iiab/issues/484#issuecomment-342151726 - name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu) lineinfile: From f9d9f5746d19866d873c16c19e1252f0d4c76945 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 16:14:44 -0500 Subject: [PATCH 29/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 9b7cf8f32..e6957b840 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -60,7 +60,7 @@ # 2. INSTALL KIWIX-TOOLS EXECUTABLES IF kiwix_force_install # (We get a whole web server for i686 but only kiwix execs for linux64 & armhf) -- name: Unarchive Kiwix to permanent location (bin_only, i.e. NOT i686) +- name: Unarchive Kiwix binaries to permanent location (NOT i686) unarchive: src: "{{ downloads_dir }}/{{ kiwix_src_file }}" dest: "{{ iiab_base }}/kiwix/bin" @@ -68,7 +68,7 @@ group: root when: kiwix_src_bin_only and kiwix_force_install -- name: Unarchive kiwix*i686.tar.bz2 to /tmp (NOT bin_only, i.e. i686) +- name: Unarchive kiwix*i686.tar.bz2 to /tmp (i686) unarchive: src: "{{ downloads_dir }}/{{ kiwix_src_file }}" dest: /tmp @@ -77,7 +77,7 @@ group: root when: not kiwix_src_bin_only and kiwix_force_install -- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (NOT bin_only, i.e. i686) +- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (i686) shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/" when: not kiwix_src_bin_only and kiwix_force_install From fe30e1f461f240cb7c4a2c6d54cecda648fe9764 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 16:41:51 -0500 Subject: [PATCH 30/82] Reinforce multiarch & offline logic. Fail w/ explanation if kiwix-tools tarfile not in place. --- roles/kiwix/tasks/main.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/roles/kiwix/tasks/main.yml b/roles/kiwix/tasks/main.yml index a12a82ece..3bf1b16f8 100644 --- a/roles/kiwix/tasks/main.yml +++ b/roles/kiwix/tasks/main.yml @@ -17,17 +17,27 @@ when: ansible_machine == "i686" # COMMENT OUT LINE ABOVE TO TEST i686 CODE PATH ON X86_64 (WORKS NOV 2017) +- debug: + msg: "WARNING: kiwix-tools SOFTWARE APPEARS UNAVAILABLE FOR YOUR OS/ARCHITECTURE." + when: not kiwix_src_file + - name: Download Kiwix software to /opt/iiab/downloads get_url: url: "{{ iiab_download_url }}/{{ kiwix_src_file }}" dest: "{{ downloads_dir }}/{{ kiwix_src_file }}" when: internet_available +- name: Check for /opt/iiab/downloads/{{ kiwix_src_file }} + stat: + path: "{{ downloads_dir }}/{{ kiwix_src_file }}" + register: kiwix_src + +- name: FAIL (force Ansible to exit) IF /opt/iiab/downloads/{{ kiwix_src_file }} doesn't exist + fail: + msg: "{ downloads_dir }}/{{ kiwix_src_file }} is REQUIRED in order to install Kiwix." + when: not kiwix_src.stat.exists + - include_tasks: kiwix_install.yml - when: kiwix_src_file is defined +# when: kiwix_src_file is defined tags: - kiwix - -- debug: - msg: "WARNING: kiwix-tools SOFTWARE NOT FOUND FOR YOUR OS/ARCHITECTURE." - when: not kiwix_src_file From aea4cf2332f42fc3ab3a5d4dbfaf27f0f3a3d5ab Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 16:49:27 -0500 Subject: [PATCH 31/82] Update main.yml --- roles/kiwix/tasks/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/kiwix/tasks/main.yml b/roles/kiwix/tasks/main.yml index 3bf1b16f8..66fe18a57 100644 --- a/roles/kiwix/tasks/main.yml +++ b/roles/kiwix/tasks/main.yml @@ -17,8 +17,9 @@ when: ansible_machine == "i686" # COMMENT OUT LINE ABOVE TO TEST i686 CODE PATH ON X86_64 (WORKS NOV 2017) -- debug: - msg: "WARNING: kiwix-tools SOFTWARE APPEARS UNAVAILABLE FOR YOUR OS/ARCHITECTURE." +- name: Warn them if kiwix-tools appears unavailable for OS/architecture" + debug: + msg: "WARNING: kiwix-tools SOFTWARE APPEARS UNAVAILABLE FOR YOUR {{ ansible_machine }} OS/ARCHITECTURE." when: not kiwix_src_file - name: Download Kiwix software to /opt/iiab/downloads From 5d6ca0492806219247fe66f2ae4610956ddc0224 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 16:56:26 -0500 Subject: [PATCH 32/82] force fail in both situations (bad arch, tarfile missing) --- roles/kiwix/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/kiwix/tasks/main.yml b/roles/kiwix/tasks/main.yml index 66fe18a57..82926db84 100644 --- a/roles/kiwix/tasks/main.yml +++ b/roles/kiwix/tasks/main.yml @@ -17,8 +17,9 @@ when: ansible_machine == "i686" # COMMENT OUT LINE ABOVE TO TEST i686 CODE PATH ON X86_64 (WORKS NOV 2017) -- name: Warn them if kiwix-tools appears unavailable for OS/architecture" - debug: +- name: FAIL (force Ansible to exit) IF kiwix-tools appears unavailable for OS/architecture +# debug: + fail: msg: "WARNING: kiwix-tools SOFTWARE APPEARS UNAVAILABLE FOR YOUR {{ ansible_machine }} OS/ARCHITECTURE." when: not kiwix_src_file @@ -39,6 +40,5 @@ when: not kiwix_src.stat.exists - include_tasks: kiwix_install.yml -# when: kiwix_src_file is defined tags: - kiwix From cde91c388b04416d5b04ce4fb02fccc71c3c7965 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 19:54:35 -0500 Subject: [PATCH 33/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index e6957b840..17a92ffdc 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -37,7 +37,7 @@ - name: Set kiwix_force_install if kiwix-serve not found set_fact: kiwix_force_install: True - when: kiwix_bin.stat.exists is defined and not kiwix_bin.stat.exists + when: not kiwix_bin.stat.exists - name: Copy test.zim file if kiwix_force_install copy: @@ -110,13 +110,6 @@ - { src: 'iiab-make-kiwix-lib.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755'} - { src: 'iiab-make-apache-config.py', dest: '/usr/bin/iiab-make-apache-config.py', mode: '0755'} -- name: Disable 'kiwix-serve' service - service: - name: kiwix-serve - enabled: no - state: stopped - when: not kiwix_enabled - - name: Enable 'kiwix-serve' service service: name: kiwix-serve @@ -124,6 +117,14 @@ state: restarted when: kiwix_enabled +- name: Disable 'kiwix-serve' service + service: + name: kiwix-serve + enabled: no + state: stopped + when: not kiwix_enabled +# IN THEORY: BOTH CRON ENTRIES BELOW *SHOULD* BE DELETED "when: not kiwix_enabled" + # In the past kiwix-serve did not stay running, so we'd been doing this hourly. # @mgautierfr & others suggest kiwix-serve might be auto-restarted w/o cron in # future, whenever service fails, if this really catches all cases?? From 03175b3a901aea5010615284beddbe02de35d83c Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:05:27 -0500 Subject: [PATCH 34/82] Update main.yml --- roles/sugarizer/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sugarizer/tasks/main.yml b/roles/sugarizer/tasks/main.yml index 363f50e5d..72a4bf4a2 100644 --- a/roles/sugarizer/tasks/main.yml +++ b/roles/sugarizer/tasks/main.yml @@ -96,7 +96,7 @@ - { name: sugarizer } when: not sugarizer_enabled -- name: Add 'sugarizer' to service list at /etc/iiab/iiab.ini +- name: Add 'sugarizer' to list of services at /etc/iiab/iiab.ini ini_file: dest: "{{ service_filelist }}" section: sugarizer From 11dec6ec323a05c2191ab6c2bed6cc15583e4698 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:05:33 -0500 Subject: [PATCH 35/82] Update main.yml --- roles/nextcloud/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index 259182c8a..2899e1a0c 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -122,7 +122,7 @@ # following enables and disables - include_tasks: nextcloud_enabled.yml -- name: Add 'nextcloud' to service list +- name: Add 'nextcloud' to list of services at /etc/iiab/iiab.ini ini_file: dest='{{ service_filelist }}' section=nextcloud option='{{ item.option }}' From 99991a3bb444828f72e375516800b56e6b967392 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:05:37 -0500 Subject: [PATCH 36/82] Update main.yml --- roles/osm/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/osm/tasks/main.yml b/roles/osm/tasks/main.yml index de2ef415f..bcfd1b51c 100644 --- a/roles/osm/tasks/main.yml +++ b/roles/osm/tasks/main.yml @@ -137,7 +137,7 @@ service: name={{ apache_service }} state=restarted -- name: Add OSM to service list +- name: Add OSM to list of services at /etc/iiab/iiab.ini ini_file: dest='{{ service_filelist }}' section=osm option='{{ item.option }}' From 4e70e8024797c37f099e1a5d6ce58f691afed073 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:05:40 -0500 Subject: [PATCH 37/82] Update main.yml --- roles/openvpn/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/openvpn/tasks/main.yml b/roles/openvpn/tasks/main.yml index ffee8caf5..c3f65802c 100644 --- a/roles/openvpn/tasks/main.yml +++ b/roles/openvpn/tasks/main.yml @@ -102,7 +102,7 @@ when: not openvpn_enabled and not installing -- name: Add OpenVPN to service list +- name: Add OpenVPN to list of services at /etc/iiab/iiab.ini ini_file: dest='{{ service_filelist }}' section=openvpn option='{{ item.option }}' From db6c3f349ce11d1ba926d0bb7a7b017cfa2bb93c Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:05:43 -0500 Subject: [PATCH 38/82] Update main.yml --- roles/kalite/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kalite/tasks/main.yml b/roles/kalite/tasks/main.yml index ed69c882d..aa43b5f22 100644 --- a/roles/kalite/tasks/main.yml +++ b/roles/kalite/tasks/main.yml @@ -34,7 +34,7 @@ - include_tasks: enable.yml -- name: Add 'kalite-serve' to service list +- name: Add 'kalite-serve' to list of services at /etc/iiab/iiab.ini ini_file: dest='{{ service_filelist }}' section=kalite option='{{ item.option }}' From 141b1af133ffd3735e8d1e4b52e1937ab2d9b80b Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:05:49 -0500 Subject: [PATCH 39/82] Update main.yml --- roles/calibre/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/calibre/tasks/main.yml b/roles/calibre/tasks/main.yml index 5b999d9f1..950ca795a 100644 --- a/roles/calibre/tasks/main.yml +++ b/roles/calibre/tasks/main.yml @@ -77,7 +77,7 @@ #async: 900 #poll: 5 -- name: Add 'calibre-serve' to service list at /etc/iiab/iiab.ini +- name: Add 'calibre-serve' to list of services at /etc/iiab/iiab.ini ini_file: dest: "{{ service_filelist }}" section: calibre From 3b51300cde1326c22d2d89df33dc5793bde1051d Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:05:53 -0500 Subject: [PATCH 40/82] Update main.yml --- roles/phpmyadmin/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/phpmyadmin/tasks/main.yml b/roles/phpmyadmin/tasks/main.yml index a2ffd40ff..80ab5cb54 100644 --- a/roles/phpmyadmin/tasks/main.yml +++ b/roles/phpmyadmin/tasks/main.yml @@ -64,7 +64,7 @@ state: absent when: not phpmyadmin_enabled and is_debuntu -- name: Add phpmyadmin to service list +- name: Add phpmyadmin to list of services at /etc/iiab/iiab.ini ini_file: dest: "{{ service_filelist }}" section: phpmyadmin From 1732d3d229f522c6c26cde12d9036eccbc68ee85 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:05:57 -0500 Subject: [PATCH 41/82] Update install.yml --- roles/wordpress/tasks/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/wordpress/tasks/install.yml b/roles/wordpress/tasks/install.yml index 564c429a7..7ffb1cfa7 100644 --- a/roles/wordpress/tasks/install.yml +++ b/roles/wordpress/tasks/install.yml @@ -123,7 +123,7 @@ - name: Restart Apache, so it picks up the new aliases service: name={{ apache_service }} state=restarted -- name: Add 'wordpress' to service list +- name: Add 'wordpress' to list of services at /etc/iiab/iiab.ini ini_file: dest='{{ service_filelist }}' section=wordpress option='{{ item.option }}' From 97cc140ac7c935ad8ef2c71019af9a7dbb8abd81 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:08:19 -0500 Subject: [PATCH 42/82] Update main.yml --- roles/osm/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/osm/tasks/main.yml b/roles/osm/tasks/main.yml index bcfd1b51c..5fb5d28d3 100644 --- a/roles/osm/tasks/main.yml +++ b/roles/osm/tasks/main.yml @@ -137,7 +137,7 @@ service: name={{ apache_service }} state=restarted -- name: Add OSM to list of services at /etc/iiab/iiab.ini +- name: Add 'osm' to list of services at /etc/iiab/iiab.ini ini_file: dest='{{ service_filelist }}' section=osm option='{{ item.option }}' From 8a7a86bce809eed260a763858554531ab47bef71 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:08:50 -0500 Subject: [PATCH 43/82] Update main.yml --- roles/openvpn/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/openvpn/tasks/main.yml b/roles/openvpn/tasks/main.yml index c3f65802c..da58b8b15 100644 --- a/roles/openvpn/tasks/main.yml +++ b/roles/openvpn/tasks/main.yml @@ -102,7 +102,7 @@ when: not openvpn_enabled and not installing -- name: Add OpenVPN to list of services at /etc/iiab/iiab.ini +- name: Add 'openvpn' to list of services at /etc/iiab/iiab.ini ini_file: dest='{{ service_filelist }}' section=openvpn option='{{ item.option }}' From 4d0ab1e324954968202dc67661d41f5c64ed9103 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:09:09 -0500 Subject: [PATCH 44/82] Update main.yml --- roles/kalite/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kalite/tasks/main.yml b/roles/kalite/tasks/main.yml index aa43b5f22..2359660ad 100644 --- a/roles/kalite/tasks/main.yml +++ b/roles/kalite/tasks/main.yml @@ -34,7 +34,7 @@ - include_tasks: enable.yml -- name: Add 'kalite-serve' to list of services at /etc/iiab/iiab.ini +- name: Add 'kalite' to list of services at /etc/iiab/iiab.ini ini_file: dest='{{ service_filelist }}' section=kalite option='{{ item.option }}' From c155ccd2f6d43c204ec75fce7679405e36b59b78 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:10:42 -0500 Subject: [PATCH 45/82] Update main.yml --- roles/sugarizer/tasks/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/sugarizer/tasks/main.yml b/roles/sugarizer/tasks/main.yml index 72a4bf4a2..f81005737 100644 --- a/roles/sugarizer/tasks/main.yml +++ b/roles/sugarizer/tasks/main.yml @@ -103,9 +103,9 @@ option: "{{ item.option }}" value: "{{ item.value }}" with_items: - - option: name - value: Sugarizer - - option: description - value: '"The Sugar Learning Platform began with the famous One Laptop Per Child project, written in Python. Sugarizer is the new HTML/JavaScript implementation of Sugar, usable in most all browsers."' - - option: enabled - value: "{{ sugarizer_enabled }}" + - option: name + value: Sugarizer + - option: description + value: '"The Sugar Learning Platform began with the famous One Laptop Per Child project, written in Python. Sugarizer is the new HTML/JavaScript implementation of Sugar, usable in most all browsers."' + - option: enabled + value: "{{ sugarizer_enabled }}" From cbb62236c8d71f906cb1bbaa46cda24e84b2e28f Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:12:09 -0500 Subject: [PATCH 46/82] Update main.yml --- roles/nextcloud/tasks/main.yml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index 2899e1a0c..24dc3c05a 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -123,18 +123,19 @@ - include_tasks: nextcloud_enabled.yml - name: Add 'nextcloud' to list of services at /etc/iiab/iiab.ini - ini_file: dest='{{ service_filelist }}' - section=nextcloud - option='{{ item.option }}' - value='{{ item.value }}' + ini_file: + dest: "{{ service_filelist }}" + section: Nextcloud + option: "{{ item.option }}" + value: "{{ item.value }}" with_items: - - option: name - value: nextcloud - - option: description - value: '"NextCloud is a local server-based facility for sharing files, photos, contacts, calendars, etc."' - - option: path - value: "{{ nextcloud_prefix }}/nextcloud" - - option: source - value: "{{ nextcloud_src_file }}" - - option: enabled - value: "{{ nextcloud_enabled }}" + - option: name + value: Nextcloud + - option: description + value: '"NextCloud is a local server-based facility for sharing files, photos, contacts, calendars, etc."' + - option: path + value: "{{ nextcloud_prefix }}/nextcloud" + - option: source + value: "{{ nextcloud_src_file }}" + - option: enabled + value: "{{ nextcloud_enabled }}" From a4290997ee93adca52ba335194a05ab8a5bc21c0 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:18:06 -0500 Subject: [PATCH 47/82] Update main.yml --- roles/osm/tasks/main.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/roles/osm/tasks/main.yml b/roles/osm/tasks/main.yml index 5fb5d28d3..bfff07863 100644 --- a/roles/osm/tasks/main.yml +++ b/roles/osm/tasks/main.yml @@ -138,16 +138,18 @@ state=restarted - name: Add 'osm' to list of services at /etc/iiab/iiab.ini - ini_file: dest='{{ service_filelist }}' - section=osm - option='{{ item.option }}' - value='{{ item.value }}' + ini_file: + dest: "{{ service_filelist }}" + section: osm + option: "{{ item.option }}" + value: "{{ item.value }}" with_items: - - option: name - value: Internet-in-a-Box - - option: description - value: '"The Internet-in-a-Box is a small, inexpensive device which provides essential Internet resources without any Internet connection. It provides a local copy of half a terabyte of the world’s Free information."' - - option: path - value: /osm - - option: enabled - value: "{{ osm_enabled }}" + - option: name + value: OpenStreetMap + - option: description + value: '"OpenStreetMap offers beautiful maps of the entire planet, continually created & updated by volunteers (much in the same way as Wikipedia) but for maps."' + # value: '"The Internet-in-a-Box is a small, inexpensive device which provides essential Internet resources without any Internet connection. It provides a local copy of half a terabyte of the world’s Free information."' + - option: path + value: /osm + - option: enabled + value: "{{ osm_enabled }}" From 0ee888c7172588ba64858bb5caa2de0c38f32807 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:19:45 -0500 Subject: [PATCH 48/82] Update main.yml --- roles/openvpn/tasks/main.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/roles/openvpn/tasks/main.yml b/roles/openvpn/tasks/main.yml index da58b8b15..e195389a6 100644 --- a/roles/openvpn/tasks/main.yml +++ b/roles/openvpn/tasks/main.yml @@ -103,20 +103,21 @@ - name: Add 'openvpn' to list of services at /etc/iiab/iiab.ini - ini_file: dest='{{ service_filelist }}' - section=openvpn - option='{{ item.option }}' - value='{{ item.value }}' + ini_file: + dest: "{{ service_filelist }}" + section: openvpn + option: "{{ item.option }}" + value: "{{ item.value }}" with_items: - - option: name - value: "openvpn" - - option: description - value: '"OpenVPN is a means of connecting to a server anywhere on the internet, via a middleman server."' - - option: middleman_url - value: "{{ vpn_presence }}" - - option: port - value: "{{ openvpn_server_port }}" - - option: enabled - value: "{{ openvpn_enabled }}" - - option: cron_enabled - value: "{{ openvpn_cron_enabled }}" + - option: name + value: OpenVPN + - option: description + value: '"OpenVPN is a means of connecting to a server anywhere on the internet, via a middleman server."' + - option: middleman_url + value: "{{ vpn_presence }}" + - option: port + value: "{{ openvpn_server_port }}" + - option: enabled + value: "{{ openvpn_enabled }}" + - option: cron_enabled + value: "{{ openvpn_cron_enabled }}" From 64e8bb15ef1b6a1018bc6e8204db8ee9db38e3ea Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:21:04 -0500 Subject: [PATCH 49/82] Update main.yml --- roles/kalite/tasks/main.yml | 41 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/roles/kalite/tasks/main.yml b/roles/kalite/tasks/main.yml index 2359660ad..f68fd7d92 100644 --- a/roles/kalite/tasks/main.yml +++ b/roles/kalite/tasks/main.yml @@ -35,24 +35,25 @@ - include_tasks: enable.yml - name: Add 'kalite' to list of services at /etc/iiab/iiab.ini - ini_file: dest='{{ service_filelist }}' - section=kalite - option='{{ item.option }}' - value='{{ item.value }}' + ini_file: + dest: "{{ service_filelist }}" + section: kalite + option: "{{ item.option }}" + value: "{{ item.value }}" with_items: - - option: name - value: kalite - - option: description - value: '"KA Lite is a server to present Khan Academy videos offline and to download them."' - - option: path - value: "{{ kalite_root }}" - - option: server_name - value: "{{ kalite_server_name }}" - - option: port - value: "{{ kalite_server_port }}" - - option: enabled - value: "{{ kalite_enabled }}" - - option: cron_enabled - value: "{{ kalite_cron_enabled }}" - - option: khan_assessment_install - value: "{{ khan_assessment_install }}" + - option: name + value: "KA Lite" + - option: description + value: '"KA Lite is a server to present Khan Academy videos offline and to download them."' + - option: path + value: "{{ kalite_root }}" + - option: server_name + value: "{{ kalite_server_name }}" + - option: port + value: "{{ kalite_server_port }}" + - option: enabled + value: "{{ kalite_enabled }}" + - option: cron_enabled + value: "{{ kalite_cron_enabled }}" + - option: khan_assessment_install + value: "{{ khan_assessment_install }}" From ec877e9c5c0192bdb3d070da5c21fdfc79b9ab1a Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:22:16 -0500 Subject: [PATCH 50/82] Update main.yml --- roles/calibre/tasks/main.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/roles/calibre/tasks/main.yml b/roles/calibre/tasks/main.yml index 950ca795a..c856328dd 100644 --- a/roles/calibre/tasks/main.yml +++ b/roles/calibre/tasks/main.yml @@ -77,20 +77,22 @@ #async: 900 #poll: 5 -- name: Add 'calibre-serve' to list of services at /etc/iiab/iiab.ini +- name: Add 'calibre' to list of services at /etc/iiab/iiab.ini ini_file: dest: "{{ service_filelist }}" section: calibre option: "{{ item.option }}" value: "{{ item.value }}" with_items: - - option: description - value: '"Calibre is an extremely popular personal library system for e-books."' - - option: url - value: "{{ calibre_src_url }}" - - option: database - value: "{{ calibre_dbpath }}" - - option: port - value: "{{ calibre_port }}" - - option: enabled - value: "{{ calibre_enabled }}" + - option: name + value: Calibre + - option: description + value: '"Calibre is an extremely popular personal library system for e-books."' + - option: url + value: "{{ calibre_src_url }}" + - option: database + value: "{{ calibre_dbpath }}" + - option: port + value: "{{ calibre_port }}" + - option: enabled + value: "{{ calibre_enabled }}" From 0eb899754842b1d02556d1959712a3fb4e76f482 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:23:07 -0500 Subject: [PATCH 51/82] Update main.yml --- roles/phpmyadmin/tasks/main.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/roles/phpmyadmin/tasks/main.yml b/roles/phpmyadmin/tasks/main.yml index 80ab5cb54..ebc15a756 100644 --- a/roles/phpmyadmin/tasks/main.yml +++ b/roles/phpmyadmin/tasks/main.yml @@ -64,18 +64,18 @@ state: absent when: not phpmyadmin_enabled and is_debuntu -- name: Add phpmyadmin to list of services at /etc/iiab/iiab.ini +- name: Add 'phpmyadmin' to list of services at /etc/iiab/iiab.ini ini_file: dest: "{{ service_filelist }}" section: phpmyadmin option: "{{ item.option }}" value: "{{ item.value }}" with_items: - - option: name - value: phpMyAdmin - - option: description - value: '"phpMyAdmin is an interface with a MySQL database written in PHP, and available to administer the database engine locally or across the network."' - - option: path - value: /opt/phpmyadmin - - option: enabled - value: "{{ phpmyadmin_enabled }}" + - option: name + value: phpMyAdmin + - option: description + value: '"phpMyAdmin is an interface with a MySQL database written in PHP, and available to administer the database engine locally or across the network."' + - option: path + value: /opt/phpmyadmin + - option: enabled + value: "{{ phpmyadmin_enabled }}" From 7c18431339ba714c31350391cf4440565fb7a292 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 20:24:49 -0500 Subject: [PATCH 52/82] Update install.yml --- roles/wordpress/tasks/install.yml | 45 ++++++++++++++++--------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/roles/wordpress/tasks/install.yml b/roles/wordpress/tasks/install.yml index 7ffb1cfa7..8dd31f132 100644 --- a/roles/wordpress/tasks/install.yml +++ b/roles/wordpress/tasks/install.yml @@ -124,26 +124,27 @@ service: name={{ apache_service }} state=restarted - name: Add 'wordpress' to list of services at /etc/iiab/iiab.ini - ini_file: dest='{{ service_filelist }}' - section=wordpress - option='{{ item.option }}' - value='{{ item.value }}' + ini_file: + dest: "{{ service_filelist }}" + section: wordpress + option: "{{ item.option }}" + value: "{{ item.value }}" with_items: - - option: name - value: wordpress - - option: description - value: '"WordPress is a blog and web site management application."' - - option: wordpress_src - value: "{{ wordpress_src }}" - - option: wp_abs_path - value: "{{ wp_abs_path }}" - - option: wp_db_name - value: "{{ wp_db_name }}" - - option: wp_db_user - value: "{{ wp_db_user }}" - - option: wp_url - value: "{{ wp_url }}" - - option: wp_full_url - value: "{{ wp_full_url }}" - - option: wordpress_enabled - value: "{{ wordpress_enabled }}" + - option: name + value: WordPress + - option: description + value: '"WordPress is a blog and web site management application."' + - option: wordpress_src + value: "{{ wordpress_src }}" + - option: wp_abs_path + value: "{{ wp_abs_path }}" + - option: wp_db_name + value: "{{ wp_db_name }}" + - option: wp_db_user + value: "{{ wp_db_user }}" + - option: wp_url + value: "{{ wp_url }}" + - option: wp_full_url + value: "{{ wp_full_url }}" + - option: wordpress_enabled + value: "{{ wordpress_enabled }}" From f00e400e94960f418bba3bd34c13350f43644430 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 21:04:38 -0500 Subject: [PATCH 53/82] fix calibre_debs_on_debian conditionals --- roles/calibre/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/calibre/tasks/main.yml b/roles/calibre/tasks/main.yml index 5b999d9f1..25d91934d 100644 --- a/roles/calibre/tasks/main.yml +++ b/roles/calibre/tasks/main.yml @@ -3,12 +3,12 @@ # RUNS IF /usr/bin/calibre-uninstall DOES NOT ALEADY EXIST - name: Install Calibre via calibre-installer.py (OS's other than Raspbian) include_tasks: py-installer.yml - when: (not is_rpi) and (not calibre_debs_on_debian) - #when: is_redhat or is_ubuntu + when: is_redhat or is_ubuntu or (is_debian and not calibre_debs_on_debian) + #when: not is_rpi - name: Install Calibre via .debs (Raspbian) include_tasks: debs.yml - when: is_rpi or calibre_debs_on_debian + when: is_rpi or (is_debian and calibre_debs_on_debian) #when: is_rpi or is_debian # (is_debian also covers & includes is_rpi) # 2. STOP CALIBRE SERVICE IF IT EXISTS (REQUIRED FOR DB ACTIVITY...AND IF not calibre_enabled) From cffabedaad663d6949fdc40003c8ebdfc4248f10 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 21:58:56 -0500 Subject: [PATCH 54/82] Update main.yml --- roles/kiwix/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index 556431ceb..4ddfda023 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -17,7 +17,7 @@ kiwix_port: 3000 iiab_zim_path: "{{ content_base }}/zims" kiwix_library_xml: "{{ iiab_zim_path }}/library.xml" # Unused: (Nov 2017) -# kiwix_content_path: "{{ iiab_zim_path }}/content" +kiwix_content_path: "{{ iiab_zim_path }}/content" # Installation Variables kiwix_install: True From 254fb22305ca0b1871ca93b4dea54f00131a1579 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 22:10:30 -0500 Subject: [PATCH 55/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 114 ++++++++++++++-------------- 1 file changed, 58 insertions(+), 56 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 17a92ffdc..f199f5f57 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -1,6 +1,4 @@ -# 1. CREATE/VERIFY CRITICAL DIRECTORIES & FILES ARE IN PLACE - -- name: Create various directories for Kiwix ZIM files +- name: Create various directories for Kiwix's ZIM files file: path: "{{ item }}" owner: root @@ -9,7 +7,7 @@ state: directory with_items: - "{{ iiab_zim_path }}" - - "{{ iiab_zim_path }}/content" + - "{{ kiwix_content_path }}" - "{{ iiab_zim_path }}/index" - name: Check for /library/zims/library.xml @@ -37,38 +35,25 @@ - name: Set kiwix_force_install if kiwix-serve not found set_fact: kiwix_force_install: True - when: not kiwix_bin.stat.exists + when: kiwix_bin.stat.exists is defined and not kiwix_bin.stat.exists -- name: Copy test.zim file if kiwix_force_install +- name: Copy test.zim file copy: src: test.zim - dest: "{{ iiab_zim_path }}/content/test.zim" + dest: "{{ kiwix_content_path }}/test.zim" mode: 0644 owner: root group: root force: no when: kiwix_force_install -- name: Create /opt/iiab/kiwix/bin directory - file: - path: "{{ iiab_base }}/kiwix/bin" - owner: root - group: root - mode: 0755 - state: directory +# We get a whole web server for i686 but only the kiwix execs for linux64 & armhf -# 2. INSTALL KIWIX-TOOLS EXECUTABLES IF kiwix_force_install -# (We get a whole web server for i686 but only kiwix execs for linux64 & armhf) - -- name: Unarchive Kiwix binaries to permanent location (NOT i686) - unarchive: - src: "{{ downloads_dir }}/{{ kiwix_src_file }}" - dest: "{{ iiab_base }}/kiwix/bin" - owner: root - group: root - when: kiwix_src_bin_only and kiwix_force_install - -- name: Unarchive kiwix*i686.tar.bz2 to /tmp (i686) +# EXPERIMENTAL i686 CODE PATH: as of Nov 2017 bunzip2 then untar unpacks +# to /tmp/kiwix-0.10-i686/bin WHOSE CONTENTS NEEDS TO BE MOVED TO +# /opt/iiab/kiwix/bin (STANZA FURTHER BELOW). All i686 code needs testing. +# ALSO: code below may need to be revived to chown -R root:root & chmod +- name: Unarchive kiwix-*-linux-i686.tar.bz2 to /tmp (not bin_only, i.e. i686) unarchive: src: "{{ downloads_dir }}/{{ kiwix_src_file }}" dest: /tmp @@ -77,11 +62,36 @@ group: root when: not kiwix_src_bin_only and kiwix_force_install -- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (i686) +- name: Create kiwix/bin directory + file: + path: "{{ iiab_base }}/kiwix/bin" + owner: root + group: root + mode: 0755 + state: directory + +# EXPERIMENTAL i686 CODE PATH +- name: move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (not bin_only, i.e. i686) shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/" when: not kiwix_src_bin_only and kiwix_force_install -# 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU +- name: Unarchive Kiwix to permanent location (bin_only, i.e. not i686) + unarchive: + src: "{{ downloads_dir }}/{{ kiwix_src_file }}" + dest: "{{ iiab_base }}/kiwix/bin" + owner: root + group: root + when: kiwix_src_bin_only and kiwix_force_install + +# MIGHT BE RESTORED LATER FOR i686? Unused as of Nov 2017: +# # workaround because unarchive does not set ownership properly +# - name: "Set ownership as if: 'chown -R root:root /opt/iiab/kiwix'" +# file: +# path: "{{ iiab_base }}/kiwix" +# owner: root +# group: root +# recurse: yes +# mode: ???? - name: Enable the mods which permit Apache to proxy (debuntu) apache2_module: @@ -93,7 +103,22 @@ - rewrite when: is_debuntu -# 4. CREATE/ENABLE/DISABLE KIWIX SERVICE & ITS CRON JOB +# workaround because kiwix-serve does not stay running +- name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu) +# * * * * * user-name command to be executed + lineinfile: + line: "0 4 * * * root /bin/systemctl restart kiwix-serve.service" + dest: /etc/crontab + when: is_debuntu + +- name: Make a crontab entry to restart kiwix-serve at 4AM (redhat) +# * * * * * user-name command to be executed + lineinfile: + line: "0 4 * * * root /usr/bin/systemctl restart kiwix-serve.service" + dest: /etc/crontab + when: is_redhat + +# Create Kiwix service - name: Create 'kiwix-serve' service template: @@ -123,30 +148,8 @@ enabled: no state: stopped when: not kiwix_enabled -# IN THEORY: BOTH CRON ENTRIES BELOW *SHOULD* BE DELETED "when: not kiwix_enabled" -# In the past kiwix-serve did not stay running, so we'd been doing this hourly. -# @mgautierfr & others suggest kiwix-serve might be auto-restarted w/o cron in -# future, whenever service fails, if this really catches all cases?? -# https://github.com/iiab/iiab/issues/484#issuecomment-342151726 -- name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu) - lineinfile: - # mn hr dy mo day-of-week[Sunday=0] username command-to-be-executed - line: "0 4 * * * root /bin/systemctl restart kiwix-serve.service" - dest: /etc/crontab - when: kiwix_enabled and is_debuntu - -- name: Make a crontab entry to restart kiwix-serve at 4AM (redhat) -# * * * * * user-name command to be executed - lineinfile: - # mn hr dy mo day-of-week[Sunday=0] username command-to-be-executed - line: "0 4 * * * root /usr/bin/systemctl restart kiwix-serve.service" - dest: /etc/crontab - when: kiwix_enabled and is_redhat - -# 5. FINALIZE - -- name: Add 'kiwix-serve' to list of services at /etc/iiab/iiab.ini +- name: Add 'kiwix-serve' to list of services at /opt/iiab/iiab.ini ini_file: dest: "{{ service_filelist }}" section: kiwix-serve @@ -157,7 +160,7 @@ value: kiwix-serve - option: description value: '"Part of https://github.com/kiwix/kiwix-tools/ - kiwix-serve is the most used web server for ZIM files."' -# The following 4 lines are unused: (Nov 2017) +# The following 4 lines are unused as of Nov 2017: # - option: kiwix_url # value: "{{ kiwix_url }}" # - option: kiwix_path @@ -168,8 +171,7 @@ value: "{{ iiab_zim_path }}" - option: kiwix_library_xml value: "{{ kiwix_library_xml }}" -# The following 2 lines are unused: (Nov 2017) -# - option: kiwix_content_path -# value: "{{ kiwix_content_path }}" + - option: kiwix_content_path + value: "{{ kiwix_content_path }}" - option: enabled value: "{{ kiwix_enabled }}" From 77ce15a72bdefa2482869cd274ccd39c964e81d5 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 22:32:06 -0500 Subject: [PATCH 56/82] Update main.yml --- roles/kiwix/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index 4ddfda023..556431ceb 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -17,7 +17,7 @@ kiwix_port: 3000 iiab_zim_path: "{{ content_base }}/zims" kiwix_library_xml: "{{ iiab_zim_path }}/library.xml" # Unused: (Nov 2017) -kiwix_content_path: "{{ iiab_zim_path }}/content" +# kiwix_content_path: "{{ iiab_zim_path }}/content" # Installation Variables kiwix_install: True From bb2f638e6bf0b2d6c59859e5d8358ee84055da6d Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 22:33:05 -0500 Subject: [PATCH 57/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 116 ++++++++++++++-------------- 1 file changed, 57 insertions(+), 59 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index f199f5f57..16527ab92 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -1,4 +1,6 @@ -- name: Create various directories for Kiwix's ZIM files +# 1. CREATE/VERIFY CRITICAL DIRECTORIES & FILES ARE IN PLACE + +- name: Create various directories for Kiwix ZIM files file: path: "{{ item }}" owner: root @@ -7,7 +9,7 @@ state: directory with_items: - "{{ iiab_zim_path }}" - - "{{ kiwix_content_path }}" + - "{{ iiab_zim_path }}/content" - "{{ iiab_zim_path }}/index" - name: Check for /library/zims/library.xml @@ -35,25 +37,38 @@ - name: Set kiwix_force_install if kiwix-serve not found set_fact: kiwix_force_install: True - when: kiwix_bin.stat.exists is defined and not kiwix_bin.stat.exists + when: not kiwix_bin.stat.exists -- name: Copy test.zim file +- name: Copy test.zim file if kiwix_force_install copy: src: test.zim - dest: "{{ kiwix_content_path }}/test.zim" + dest: "{{ iiab_zim_path }}/content/test.zim" mode: 0644 owner: root group: root force: no when: kiwix_force_install -# We get a whole web server for i686 but only the kiwix execs for linux64 & armhf +- name: Create /opt/iiab/kiwix/bin directory + file: + path: "{{ iiab_base }}/kiwix/bin" + owner: root + group: root + mode: 0755 + state: directory -# EXPERIMENTAL i686 CODE PATH: as of Nov 2017 bunzip2 then untar unpacks -# to /tmp/kiwix-0.10-i686/bin WHOSE CONTENTS NEEDS TO BE MOVED TO -# /opt/iiab/kiwix/bin (STANZA FURTHER BELOW). All i686 code needs testing. -# ALSO: code below may need to be revived to chown -R root:root & chmod -- name: Unarchive kiwix-*-linux-i686.tar.bz2 to /tmp (not bin_only, i.e. i686) +# 2. INSTALL KIWIX-TOOLS EXECUTABLES IF kiwix_force_install +# (We get a whole web server for i686 but only kiwix execs for linux64 & armhf) + +- name: Unarchive Kiwix binaries to permanent location (NOT i686) + unarchive: + src: "{{ downloads_dir }}/{{ kiwix_src_file }}" + dest: "{{ iiab_base }}/kiwix/bin" + owner: root + group: root + when: kiwix_src_bin_only and kiwix_force_install + +- name: Unarchive kiwix*i686.tar.bz2 to /tmp (i686) unarchive: src: "{{ downloads_dir }}/{{ kiwix_src_file }}" dest: /tmp @@ -62,36 +77,11 @@ group: root when: not kiwix_src_bin_only and kiwix_force_install -- name: Create kiwix/bin directory - file: - path: "{{ iiab_base }}/kiwix/bin" - owner: root - group: root - mode: 0755 - state: directory - -# EXPERIMENTAL i686 CODE PATH -- name: move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (not bin_only, i.e. i686) +- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (i686) shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/" when: not kiwix_src_bin_only and kiwix_force_install -- name: Unarchive Kiwix to permanent location (bin_only, i.e. not i686) - unarchive: - src: "{{ downloads_dir }}/{{ kiwix_src_file }}" - dest: "{{ iiab_base }}/kiwix/bin" - owner: root - group: root - when: kiwix_src_bin_only and kiwix_force_install - -# MIGHT BE RESTORED LATER FOR i686? Unused as of Nov 2017: -# # workaround because unarchive does not set ownership properly -# - name: "Set ownership as if: 'chown -R root:root /opt/iiab/kiwix'" -# file: -# path: "{{ iiab_base }}/kiwix" -# owner: root -# group: root -# recurse: yes -# mode: ???? +# 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU - name: Enable the mods which permit Apache to proxy (debuntu) apache2_module: @@ -103,22 +93,7 @@ - rewrite when: is_debuntu -# workaround because kiwix-serve does not stay running -- name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu) -# * * * * * user-name command to be executed - lineinfile: - line: "0 4 * * * root /bin/systemctl restart kiwix-serve.service" - dest: /etc/crontab - when: is_debuntu - -- name: Make a crontab entry to restart kiwix-serve at 4AM (redhat) -# * * * * * user-name command to be executed - lineinfile: - line: "0 4 * * * root /usr/bin/systemctl restart kiwix-serve.service" - dest: /etc/crontab - when: is_redhat - -# Create Kiwix service +# 4. CREATE/ENABLE/DISABLE KIWIX SERVICE & ITS CRON JOB - name: Create 'kiwix-serve' service template: @@ -148,8 +123,30 @@ enabled: no state: stopped when: not kiwix_enabled +# IN THEORY: BOTH CRON ENTRIES BELOW *SHOULD* BE DELETED "when: not kiwix_enabled" -- name: Add 'kiwix-serve' to list of services at /opt/iiab/iiab.ini +# In the past kiwix-serve did not stay running, so we'd been doing this hourly. +# @mgautierfr & others suggest kiwix-serve might be auto-restarted w/o cron in +# future, whenever service fails, if this really catches all cases?? +# https://github.com/iiab/iiab/issues/484#issuecomment-342151726 +- name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu) + lineinfile: + # mn hr dy mo day-of-week[Sunday=0] username command-to-be-executed + line: "0 4 * * * root /bin/systemctl restart kiwix-serve.service" + dest: /etc/crontab + when: kiwix_enabled and is_debuntu + +- name: Make a crontab entry to restart kiwix-serve at 4AM (redhat) +# * * * * * user-name command to be executed + lineinfile: + # mn hr dy mo day-of-week[Sunday=0] username command-to-be-executed + line: "0 4 * * * root /usr/bin/systemctl restart kiwix-serve.service" + dest: /etc/crontab + when: kiwix_enabled and is_redhat + +# 5. FINALIZE + +- name: Add 'kiwix-serve' to list of services at /etc/iiab/iiab.ini ini_file: dest: "{{ service_filelist }}" section: kiwix-serve @@ -160,7 +157,7 @@ value: kiwix-serve - option: description value: '"Part of https://github.com/kiwix/kiwix-tools/ - kiwix-serve is the most used web server for ZIM files."' -# The following 4 lines are unused as of Nov 2017: +# The following 4 lines are unused: (Nov 2017) # - option: kiwix_url # value: "{{ kiwix_url }}" # - option: kiwix_path @@ -171,7 +168,8 @@ value: "{{ iiab_zim_path }}" - option: kiwix_library_xml value: "{{ kiwix_library_xml }}" - - option: kiwix_content_path - value: "{{ kiwix_content_path }}" +# The following 2 lines are unused: (Nov 2017) +# - option: kiwix_content_path +# value: "{{ kiwix_content_path }}" - option: enabled - value: "{{ kiwix_enabled }}" +value: "{{ kiwix_enabled }}" From 036f4634df6012cd0e38cf418beca63c7a3b40da Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 26 Nov 2017 22:57:03 -0500 Subject: [PATCH 58/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 16527ab92..17a92ffdc 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -172,4 +172,4 @@ # - option: kiwix_content_path # value: "{{ kiwix_content_path }}" - option: enabled -value: "{{ kiwix_enabled }}" + value: "{{ kiwix_enabled }}" From d84c14e2b679292d7ad896e6409a3bdca1d02144 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Nov 2017 12:08:11 -0500 Subject: [PATCH 59/82] reboot_to_AP: False (for installs via WiFi) --- vars/default_vars.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 1447e5f5b..ad6d7bf9e 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -69,6 +69,8 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme +# Option to reboot to Access Point after installing over WiFi (equiv to running iiab-hotspot-on) +reboot_to_AP: False # Gateway mode iiab_lan_enabled: True From 6ebd0bceb727c0311c2937ff039ef39f73736143 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Nov 2017 12:14:12 -0500 Subject: [PATCH 60/82] Update default_vars.yml --- vars/default_vars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index ad6d7bf9e..a31d20812 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -69,7 +69,7 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme -# Option to reboot to Access Point after installing over WiFi (equiv to running iiab-hotspot-on) +# Option to reboot to internal WiFi Access Point after installing IIAB over WiFi (equiv to running iiab-hotspot-on) reboot_to_AP: False # Gateway mode From b3e2df779fdf5835d433c3c9b8afddeec8659875 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Nov 2017 12:16:17 -0500 Subject: [PATCH 61/82] Update default_vars.yml --- vars/default_vars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index a31d20812..4da77904c 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -69,7 +69,7 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme -# Option to reboot to internal WiFi Access Point after installing IIAB over WiFi (equiv to running iiab-hotspot-on) +# Option to reboot to internal WiFi Access Point after installing IIAB over WiFi (equiv to running iiab-hotspot-on). This only works with RPi's for now: reboot_to_AP: False # Gateway mode From 3a054a396d62409f2c7f78cf1b209dae0ebd41b9 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Nov 2017 12:23:47 -0500 Subject: [PATCH 62/82] Update default_vars.yml --- vars/default_vars.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 4da77904c..461ea34c2 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -69,7 +69,9 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme -# Option to reboot to internal WiFi Access Point after installing IIAB over WiFi (equiv to running iiab-hotspot-on). This only works with RPi's for now: +# For those installing IIAB over WiFi: "reboot_to_AP: True" makes the internal +# WiFi Access active after the next reboot. This is equivalent to manually +# running "iiab-hotspot-on". Note this variable only works with RPi's for now. reboot_to_AP: False # Gateway mode From c14584b81c3871996cac93d53c30b2ac4941ac8d Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Nov 2017 13:03:20 -0500 Subject: [PATCH 63/82] kiwix_url: & kiwix_path: unused but should be --- roles/kiwix/defaults/main.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index 556431ceb..7b8524446 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -6,9 +6,10 @@ kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" # Published Oct 2016 ("ex # KIWIX FOR i686 SHOULD BE REPLACED BEFORE FEB 2018: https://github.com/kiwix/kiwix-build/issues/94 kiwix_port: 3000 -# The following 2 lines are unused: (Nov 2017) -# kiwix_url: /kiwix -# kiwix_path: "{{ iiab_base }}/kiwix" +# Expected to be used soon for Kiwix proxy: +kiwix_url: /kiwix +# Unused in Nov 2017, but should be: +kiwix_path: "{{ iiab_base }}/kiwix" # /library/zims contains 3 important things: # - library.xml From 4c8795b22d4a9f164915724b1a6ec77d63c3da8d Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Nov 2017 13:07:28 -0500 Subject: [PATCH 64/82] {{ iiab_path }}/kiwix -> {{ kiwix_path }} --- roles/kiwix/tasks/kiwix_install.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 17a92ffdc..ba47ad0d1 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -31,7 +31,7 @@ - name: Check for /opt/iiab/kiwix/bin/kiwix-serve binary stat: - path: "{{ iiab_base }}/kiwix/bin/kiwix-serve" + path: "{{ kiwix_path }}/bin/kiwix-serve" register: kiwix_bin - name: Set kiwix_force_install if kiwix-serve not found @@ -51,7 +51,7 @@ - name: Create /opt/iiab/kiwix/bin directory file: - path: "{{ iiab_base }}/kiwix/bin" + path: "{{ kiwix_path }}/bin" owner: root group: root mode: 0755 @@ -63,7 +63,7 @@ - name: Unarchive Kiwix binaries to permanent location (NOT i686) unarchive: src: "{{ downloads_dir }}/{{ kiwix_src_file }}" - dest: "{{ iiab_base }}/kiwix/bin" + dest: "{{ kiwix_path }}/bin" owner: root group: root when: kiwix_src_bin_only and kiwix_force_install @@ -78,7 +78,7 @@ when: not kiwix_src_bin_only and kiwix_force_install - name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (i686) - shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/" + shell: "mv /tmp/kiwix*i686/bin/* {{ kiwix_path }}/bin/" when: not kiwix_src_bin_only and kiwix_force_install # 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU From a9c27618aaad1b3913fd0c0e352c0f4dd78e18ec Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 27 Nov 2017 13:09:32 -0500 Subject: [PATCH 65/82] Update kiwix_install.yml --- roles/kiwix/tasks/kiwix_install.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index ba47ad0d1..e618ddc25 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -157,11 +157,10 @@ value: kiwix-serve - option: description value: '"Part of https://github.com/kiwix/kiwix-tools/ - kiwix-serve is the most used web server for ZIM files."' -# The following 4 lines are unused: (Nov 2017) -# - option: kiwix_url -# value: "{{ kiwix_url }}" -# - option: kiwix_path -# value: "{{ kiwix_path }}" + - option: kiwix_url + value: "{{ kiwix_url }}" + - option: kiwix_path + value: "{{ kiwix_path }}" - option: kiwix_port value: "{{ kiwix_port }}" - option: iiab_zim_path From 7dcfdd3a8b5db1327465465afc7fbdb6187b056a Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 29 Nov 2017 16:05:36 -0500 Subject: [PATCH 66/82] clean reinstall of WordPress clarified --- roles/wordpress/tasks/install.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/roles/wordpress/tasks/install.yml b/roles/wordpress/tasks/install.yml index 8dd31f132..2d7da474f 100644 --- a/roles/wordpress/tasks/install.yml +++ b/roles/wordpress/tasks/install.yml @@ -1,16 +1,15 @@ -# IF YOU NEED TO REINSTALL FROM /opt/iiab/downloads/wordpress.tar.gz -# TO /library/wordpress DURING YOUR NEXT RUN OF "./runtags wordpress" OR -# "./iiab-install" THEN YOU FIRST NEED TO: +# "Emergency" reinstalls (from /opt/iiab/downloads/wordpress.tar.gz +# to /library/wordpress) should also work offline... # -# - "mv /library/wordpress /library/wordpress.old" (MUST) -# - back up then drop the database (RECOMMENDED) +# EITHER WAY, IF YOU NEED A CLEAN REINSTALL OF WORDPRESS DURING YOUR +# NEXT RUN OF "./runtags wordpress" OR "./iiab-install" PLEASE FIRST DO: +# +# - "mv /library/wordpress /library/wordpress.old" +# - back up WordPress's database then drop it # # REASON: "keep_newer: yes" below tries to preserves WordPress's self-upgrades -# & security enhancements within /library/wordpress, that can occur without +# & security enhancements within /library/wordpress, that can arise without # warning when WordPress is online, since WordPress ~4.8 especially. -# -# Such "emergency" reinstalls from /opt/iiab/downloads/wordpress.tar.gz to -# /library/wordpress should also work offline. - name: Download the latest WordPress software get_url: From 2c565a6c10b9b8ddd266fa254a63e22acce2768b Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 29 Nov 2017 20:25:09 -0500 Subject: [PATCH 67/82] Update install.yml --- roles/wordpress/tasks/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/wordpress/tasks/install.yml b/roles/wordpress/tasks/install.yml index 2d7da474f..402fbc5da 100644 --- a/roles/wordpress/tasks/install.yml +++ b/roles/wordpress/tasks/install.yml @@ -1,7 +1,7 @@ # "Emergency" reinstalls (from /opt/iiab/downloads/wordpress.tar.gz # to /library/wordpress) should also work offline... # -# EITHER WAY, IF YOU NEED A CLEAN REINSTALL OF WORDPRESS DURING YOUR +# ONLINE OR OFFLINE, IF YOU NEED A CLEAN REINSTALL OF WORDPRESS DURING YOUR # NEXT RUN OF "./runtags wordpress" OR "./iiab-install" PLEASE FIRST DO: # # - "mv /library/wordpress /library/wordpress.old" From 49f66f560a367a2c1828f076398ad04b2d875e6f Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 29 Nov 2017 20:32:46 -0500 Subject: [PATCH 68/82] clarif: how to clean-install of WordPress --- roles/wordpress/tasks/install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/wordpress/tasks/install.yml b/roles/wordpress/tasks/install.yml index 402fbc5da..03f64b68e 100644 --- a/roles/wordpress/tasks/install.yml +++ b/roles/wordpress/tasks/install.yml @@ -8,8 +8,8 @@ # - back up WordPress's database then drop it # # REASON: "keep_newer: yes" below tries to preserves WordPress's self-upgrades -# & security enhancements within /library/wordpress, that can arise without -# warning when WordPress is online, since WordPress ~4.8 especially. +# and security enhancements using timestamps under /library/wordpress, as these +# can arise without warning when WordPress is online, since WordPress ~4.8. - name: Download the latest WordPress software get_url: From 1721becd93327f45770a28cae1f8129e271af7ee Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 1 Dec 2017 11:43:03 -0500 Subject: [PATCH 69/82] kiwix-tools 2017-11-12 -> 2017-12-01 --- roles/kiwix/defaults/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index 7b8524446..bbf24e399 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -1,6 +1,6 @@ # Which kiwix-tools to download from http://download.iiab.io/packages/ (origin: http://download.kiwix.org/nightly/) -kiwix_src_file_armhf: "kiwix-tools_armhf_2017-11-12.tar.gz" -kiwix_src_file_linux64: "kiwix-tools_linux64_2017-11-12.tar.gz" +kiwix_src_file_armhf: "kiwix-tools_armhf_2017-12-01.tar.gz" +kiwix_src_file_linux64: "kiwix_tools_linux64_2017-12-01.tar.gz" kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" # Published Oct 2016 ("experimental") # kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2" # Published May 2014 ("use v0.9 to test legacy ZIM content") # KIWIX FOR i686 SHOULD BE REPLACED BEFORE FEB 2018: https://github.com/kiwix/kiwix-build/issues/94 From 318e4809db17f12929fd450cbb262581abbc5b69 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Sat, 2 Dec 2017 11:49:25 -0500 Subject: [PATCH 70/82] apache proxy for kiwix --- roles/kiwix/defaults/main.yml | 2 +- roles/kiwix/tasks/kiwix_install.yml | 11 +++++++++-- roles/kiwix/templates/iiab-make-kiwix-lib | 2 +- roles/kiwix/templates/kiwix-serve.service.j2 | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index bbf24e399..0291ed4a5 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -7,7 +7,7 @@ kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" # Published Oct 2016 ("ex kiwix_port: 3000 # Expected to be used soon for Kiwix proxy: -kiwix_url: /kiwix +kiwix_url: /kiwix/ # Unused in Nov 2017, but should be: kiwix_path: "{{ iiab_base }}/kiwix" diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index e618ddc25..05b0d7602 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -95,7 +95,7 @@ # 4. CREATE/ENABLE/DISABLE KIWIX SERVICE & ITS CRON JOB -- name: Create 'kiwix-serve' service +- name: Create 'kiwix-serve' service and related files template: backup: no src: "{{ item.src }}" @@ -108,7 +108,14 @@ # - { src: 'kiwix-serve-init.j2', dest: '/usr/libexec/kiwix-serve-init', mode: '0755'} - { src: 'iiab-make-kiwix-lib', dest: '/usr/bin/iiab-make-kiwix-lib', mode: '0755'} - { src: 'iiab-make-kiwix-lib.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755'} - - { src: 'iiab-make-apache-config.py', dest: '/usr/bin/iiab-make-apache-config.py', mode: '0755'} +# - { src: 'iiab-make-apache-config.py', dest: '/usr/bin/iiab-make-apache-config.py', mode: '0755'} + - { src: 'kiwix.conf.j2', dest: '/etc/{{ apache_config_dir }}/kiwix.conf', mode: '0644'} + +- name: Enable Kiwix Proxy in Apache - is disabled by turning off kiwix service + file: path=/etc/apache2/sites-enabled/kiwix.conf + src=/etc/apache2/sites-available/kiwix.conf + state=link + when: is_debuntu - name: Enable 'kiwix-serve' service service: diff --git a/roles/kiwix/templates/iiab-make-kiwix-lib b/roles/kiwix/templates/iiab-make-kiwix-lib index 11a4b1d2a..e7ab98197 100644 --- a/roles/kiwix/templates/iiab-make-kiwix-lib +++ b/roles/kiwix/templates/iiab-make-kiwix-lib @@ -2,7 +2,7 @@ {{ systemctl_program }} stop kiwix-serve /usr/bin/iiab-make-kiwix-lib.py -/usr/bin/iiab-make-apache-config.py +#/usr/bin/iiab-make-apache-config.py {{ systemctl_program }} start kiwix-serve exit 0 diff --git a/roles/kiwix/templates/kiwix-serve.service.j2 b/roles/kiwix/templates/kiwix-serve.service.j2 index c4af3c797..d09bb062a 100644 --- a/roles/kiwix/templates/kiwix-serve.service.j2 +++ b/roles/kiwix/templates/kiwix-serve.service.j2 @@ -4,7 +4,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 }} +ExecStart={{ iiab_base }}/kiwix/bin/kiwix-serve --daemon --port {{ kiwix_port }} --nolibrarybutton --library {{ kiwix_library_xml }} --urlRootLocation={{ kiwix_url }} [Install] WantedBy=multi-user.target From d1e28a1306b3a9df75d6c3dd7ce57a925ac9d7f1 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Sat, 2 Dec 2017 16:44:27 -0500 Subject: [PATCH 71/82] add missing kiwix.conf.j2 --- roles/kiwix/templates/kiwix.conf.j2 | 1 + 1 file changed, 1 insertion(+) create mode 100644 roles/kiwix/templates/kiwix.conf.j2 diff --git a/roles/kiwix/templates/kiwix.conf.j2 b/roles/kiwix/templates/kiwix.conf.j2 new file mode 100644 index 000000000..a191cdb81 --- /dev/null +++ b/roles/kiwix/templates/kiwix.conf.j2 @@ -0,0 +1 @@ +ProxyPass {{ kiwix_url }} http://127.0.0.1:{{ kiwix_port }}{{ kiwix_url }} \ No newline at end of file From 51583491f1348893bc3a1a17ce784de274828ea1 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Sat, 2 Dec 2017 16:53:36 -0500 Subject: [PATCH 72/82] restart apache --- roles/kiwix/tasks/kiwix_install.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index 05b0d7602..1a81ac77f 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -151,6 +151,9 @@ dest: /etc/crontab when: kiwix_enabled and is_redhat +- name: Restart apache, so it picks up kiwix.conf + service: name={{ apache_service }} state=restarted + # 5. FINALIZE - name: Add 'kiwix-serve' to list of services at /etc/iiab/iiab.ini From dd0754fd7ca2a9c1ddb4c2bd5ac0f362e22a3583 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 3 Dec 2017 09:47:03 -0600 Subject: [PATCH 73/82] force br0 to always be available on rpi --- roles/network/templates/network/rpi.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/network/templates/network/rpi.j2 b/roles/network/templates/network/rpi.j2 index 4b8f86e9f..e0f21745a 100644 --- a/roles/network/templates/network/rpi.j2 +++ b/roles/network/templates/network/rpi.j2 @@ -7,6 +7,8 @@ auto br0 iface br0 inet manual {% if iiab_wired_lan_iface is defined %} bridge_ports {{ iiab_wired_lan_iface }} +{% else %} + bridge_ports none {% endif %} bridge_maxwait 0 dns-nameservers 127.0.0.1 From ee735fa1e210aea9d95d845727fed8e2ce9b1b18 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 4 Dec 2017 09:56:54 -0500 Subject: [PATCH 74/82] nextcloud_force_install: False --- roles/nextcloud/defaults/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/nextcloud/defaults/main.yml b/roles/nextcloud/defaults/main.yml index fa7f84786..159f3641a 100644 --- a/roles/nextcloud/defaults/main.yml +++ b/roles/nextcloud/defaults/main.yml @@ -1,11 +1,15 @@ nextcloud_install: True nextcloud_enabled: False +# REMOVE /opt/nextcloud/version.php TO FORCE AN UPGRADE OR REINSTALL +nextcloud_force_install: False + nextcloud_url: /nextcloud nextcloud_prefix: /opt nextcloud_data_dir: "{{ content_base }}/nextcloud/data" nextcloud_dl_url: https://download.nextcloud.com/server/releases/ -nextcloud_src_file: latest-12.tar.bz2 +nextcloud_orig_src_file: latest-12.tar.bz2 +nextcloud_src_file: nextcloud_{{ nextcloud_orig_src_file }} # we install on mysql with these setting or those from default_vars, etc. nextcloud_dbname: nextcloud From 6ae4d9dcf5bffee196e5a9d94f943209803958f3 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 4 Dec 2017 10:00:27 -0500 Subject: [PATCH 75/82] implement nextcloud_force_install on trigger --- roles/nextcloud/tasks/main.yml | 135 ++++++++++++++++++++------------- 1 file changed, 84 insertions(+), 51 deletions(-) diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index 24dc3c05a..ef78baadc 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -1,31 +1,43 @@ -# we need to install the rpm in order to get the dependencies -# but we only need to do this the first time - -- name: See if the Nextcloud startup page exists - stat: path={{ nextcloud_prefix }}/nextcloud/index.php +- name: See if Nextcloud version page exists + stat: + path: "{{ nextcloud_prefix }}/nextcloud/version.php" +# path: "{{ nextcloud_prefix }}/nextcloud/index.php" register: nextcloud_page +- name: FORCE UPGRADE OR INSTALL IF /opt/nextcloud/version.php DOESN'T EXIST + set_fact: + nextcloud_force_install: True + when: not nextcloud_page.stat.exists -# but we use the tar file to get the latest version +# - debug: +# msg: "nextcloud_force_install: {{ nextcloud_force_install }}" -- name: Get the Nextcloud software - get_url: url={{ nextcloud_dl_url }}/{{ nextcloud_src_file }} dest={{ downloads_dir }}/{{ nextcloud_src_file }} - when: internet_available + +- name: Download latest Nextcloud software to /opt/iiab/download/{{ nextcloud_src_file }} + get_url: + url: "{{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file }}" + dest: "{{ downloads_dir }}/{{ nextcloud_src_file }}" + force: yes + when: internet_available and nextcloud_force_install async: 900 poll: 15 tags: - download - name: Ubuntu and Debian treat names differently (Debian) - package: name={{ item }} state=present + package: + name: "{{ item }}" + state: present with_items: - - libapache2-mod-php{{ php_version }} - - php{{ php_version }}-mbstring - - php{{ php_version }}-zip + - "libapache2-mod-php{{ php_version }}" + - "php{{ php_version }}-mbstring" + - "php{{ php_version }}-zip" when: is_debian - name: Ubuntu and Debian treat names differently (Ubuntu) - package: name={{ item }} state=present + package: + name: "{{ item }}" + state: present with_items: - libapache2-mod-php - php-imagick @@ -34,18 +46,25 @@ when: is_ubuntu - name: Install list of packages (debuntu) - package: name={{ item }} state=present + package: + name: "{{ item }}" + state: present with_items: - - php{{ php_version }}-gd - - php{{ php_version }}-json - - php{{ php_version }}-mysql - - php{{ php_version }}-curl - - php{{ php_version }}-intl - - php{{ php_version }}-mcrypt + - "php{{ php_version }}-gd" + - "php{{ php_version }}-json" + - "php{{ php_version }}-mysql" + - "php{{ php_version }}-curl" + - "php{{ php_version }}-intl" + - "php{{ php_version }}-mcrypt" when: is_debuntu +# we need to install the rpm in order to get the dependencies +# but we only need to do this the first time + - name: Install list of packages (redhat) - package: name={{ item }} state=present + package: + name: "{{ item }}" + state: present with_items: - php - php-gd @@ -59,52 +78,63 @@ when: is_redhat - name: Copy it to permanent location /opt (OS's other than Fedora 18) - unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }} - dest={{ nextcloud_prefix }} - creates={{ nextcloud_prefix }}/nextcloud/version.php - when: not is_F18 + unarchive: + src: "{{ downloads_dir }}/{{ nextcloud_src_file }}" + dest: "{{ nextcloud_prefix }}" +# creates: "{{ nextcloud_prefix }}/nextcloud/version.php" + when: not is_F18 and nextcloud_force_install -# ansible 1.4.1 does not have "creates" +# Ansible 1.4.1 does not have "creates" (but hopefully has "when") - name: Copy it to permanent location /opt (Fedora 18) - unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }} - dest={{ nextcloud_prefix }} - when: is_F18 + unarchive: + src: "{{ downloads_dir }}/{{ nextcloud_src_file }}" + dest: "{{ nextcloud_prefix }}" + when: is_F18 and nextcloud_force_install - name: In CentOS, the following config dir is symlink to /etc/nextcloud - file: path=/etc/nextcloud - state=directory + file: + path: /etc/nextcloud + state: directory when: is_centos - name: Add autoconfig file (CentOS) - template: src=autoconfig.php.j2 - dest={{ nextcloud_prefix }}/nextcloud/config/autoconfig.php - owner={{ apache_user }} - group={{ apache_user }} - mode=0640 + template: + src: autoconfig.php.j2 + dest: "{{ nextcloud_prefix }}/nextcloud/config/autoconfig.php" + owner: "{{ apache_user }}" + group: "{{ apache_user }}" + mode: 0640 when: is_centos - name: Make Apache owner - file: path={{ nextcloud_prefix }}/nextcloud - owner={{ apache_user }} - group={{ apache_user }} - recurse=yes - state=directory + file: + path: "{{ nextcloud_prefix }}/nextcloud" + owner: "{{ apache_user }}" + group: "{{ apache_user }}" + recurse: yes + state: directory - name: Create data directory library - file: path={{ item }} - mode=0750 - owner={{ apache_user }} - group={{ apache_user }} - state=directory + file: + path: "{{ item }}" + owner: "{{ apache_user }}" + group: "{{ apache_user }}" + mode: 0750 + state: directory with_items: - "{{ nextcloud_data_dir }}" - name: Create a MySQL database for Nextcloud - mysql_db: name={{ nextcloud_dbname }} + mysql_db: + name: "{{ nextcloud_dbname }}" when: mysql_enabled and nextcloud_enabled - name: Create a user to access the Nextcloud database - mysql_user: name={{ nextcloud_dbuser }} host={{ item }} password={{ nextcloud_dbpassword }} priv={{ nextcloud_dbname }}.*:ALL,GRANT + mysql_user: + name: "{{ nextcloud_dbuser }}" + host: "{{ item }}" + password: "{{ nextcloud_dbpassword }}" + priv: "{{ nextcloud_dbname }}.*:ALL,GRANT" with_items: - "{{ nextcloud_dbhost }}" - 127.0.0.1 @@ -114,8 +144,11 @@ - name: Restart Apache, so it picks up the new aliases - service: name={{ apache_service }} state=restarted - when: not nextcloud_enabled + service: + name: "{{ apache_service }}" + state: restarted + when: nextcloud_enabled +# when: not nextcloud_enabled # Enable nextcloud by copying template to httpd config From e798cfe1a4dbdc6cf9940a66ff87d7742331d024 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 4 Dec 2017 10:14:05 -0500 Subject: [PATCH 76/82] Apache is restarted regardless (flow can be improved later) --- roles/nextcloud/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index ef78baadc..46be5d4ab 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -147,8 +147,8 @@ service: name: "{{ apache_service }}" state: restarted - when: nextcloud_enabled -# when: not nextcloud_enabled +# when: nextcloud_enabled # taken care of by nextcloud_enabled.yml below + when: not nextcloud_enabled # Enable nextcloud by copying template to httpd config From 8af7e21537a06d5a71546bee86a1bc592115c104 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 4 Dec 2017 10:23:04 -0500 Subject: [PATCH 77/82] clarify force: does install/reinstall/upgrade --- roles/nextcloud/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index 46be5d4ab..c8e29240c 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -4,7 +4,7 @@ # path: "{{ nextcloud_prefix }}/nextcloud/index.php" register: nextcloud_page -- name: FORCE UPGRADE OR INSTALL IF /opt/nextcloud/version.php DOESN'T EXIST +- name: FORCE INSTALL OR REINSTALL OR UPGRADE IF /opt/nextcloud/version.php DOESN'T EXIST set_fact: nextcloud_force_install: True when: not nextcloud_page.stat.exists From 64ada359aea6291bd8c86f6faf3930e6d3d8c3c6 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 4 Dec 2017 10:24:25 -0500 Subject: [PATCH 78/82] clarify force: does install/reinstall/upgrade --- roles/nextcloud/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/nextcloud/defaults/main.yml b/roles/nextcloud/defaults/main.yml index 159f3641a..26b90c3fe 100644 --- a/roles/nextcloud/defaults/main.yml +++ b/roles/nextcloud/defaults/main.yml @@ -1,7 +1,7 @@ nextcloud_install: True nextcloud_enabled: False -# REMOVE /opt/nextcloud/version.php TO FORCE AN UPGRADE OR REINSTALL +# REMOVE /opt/nextcloud/version.php TO FORCE AN INSTALL OR REINSTALL OR UPGRADE nextcloud_force_install: False nextcloud_url: /nextcloud From 2df3afbc78b49378d8050521d93102be85777c6d Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 4 Dec 2017 18:18:07 -0500 Subject: [PATCH 79/82] "reboot_to_AP: False" (today for RPi only) was being ignored --- roles/network/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 0e51de1be..55b2a2eba 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -14,7 +14,7 @@ iiab_wan_iface: "{{ discovered_wired_iface }}" iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}" iiab_wired_lan_iface: "" - when: is_rpi and discovered_wireless_iface is defined and discovered_wireless_iface == iiab_wan_iface and reboot_to_AP is defined + when: is_rpi and discovered_wireless_iface is defined and discovered_wireless_iface == iiab_wan_iface and reboot_to_AP - include_tasks: computed_network.yml when: not installing From 7dbd8f6429738bfc6bac604544a174bdb47b43c0 Mon Sep 17 00:00:00 2001 From: A Holt Date: Tue, 5 Dec 2017 00:42:03 -0500 Subject: [PATCH 80/82] phpMyAdmin 4.7.5 -> 4.7.6 --- roles/phpmyadmin/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/phpmyadmin/defaults/main.yml b/roles/phpmyadmin/defaults/main.yml index 9ef75d830..8f0f0a469 100644 --- a/roles/phpmyadmin/defaults/main.yml +++ b/roles/phpmyadmin/defaults/main.yml @@ -1,4 +1,4 @@ phpmyadmin_install: False phpmyadmin_enabled: False -phpmyadmin_name: "phpMyAdmin-4.7.5-all-languages" +phpmyadmin_name: "phpMyAdmin-4.7.6-all-languages" phpmyadmin_name_zip: "{{ phpmyadmin_name }}.zip" From d5e667bb5e8ccc72b6f7c8541873fb1ba8c259e5 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 6 Dec 2017 11:31:08 -0500 Subject: [PATCH 81/82] Elgg 2.3.4 -> 2.3.5 --- roles/elgg/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/elgg/defaults/main.yml b/roles/elgg/defaults/main.yml index 76074ae84..0872a6828 100644 --- a/roles/elgg/defaults/main.yml +++ b/roles/elgg/defaults/main.yml @@ -1,5 +1,5 @@ elgg_xx: elgg -elgg_version: "2.3.4" +elgg_version: "2.3.5" # elgg_mysql_password: defined in default_vars elgg_url: /elgg From 121f5d409d03e3bc8b25c850190c94544582853a Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 6 Dec 2017 11:37:38 -0500 Subject: [PATCH 82/82] OS messaging consistent w/ other playbooks --- roles/osm/tasks/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/osm/tasks/main.yml b/roles/osm/tasks/main.yml index bfff07863..9cb4c3105 100644 --- a/roles/osm/tasks/main.yml +++ b/roles/osm/tasks/main.yml @@ -71,13 +71,13 @@ osm_path: "{{ osm_venv }}/lib/python2.7/site-packages/iiab" when: osm_enabled and is_debuntu -- name: All - Point wsgi to virtual environment +- name: Point wsgi to virtual environment (all OS's) lineinfile: dest={{ osm_venv }}/bin/iiab.wsgi regexp="path_to_virtualenv = None" line="path_to_virtualenv = '/usr/local/osm'" state=present -- name: All - Copy OSM config file +- name: Copy OSM config file (all OS's) template: backup=no src=osm.conf.j2 dest=/etc/{{ apache_config_dir }}/osm.conf @@ -86,28 +86,28 @@ mode=0644 when: osm_enabled -- name: Debuntu - Create a link from sites-enabled to sites-available +- name: Create a link from sites-enabled to sites-available (debuntu) file: src=/etc/{{ apache_config_dir }}/osm.conf dest=/etc/apache2/sites-enabled/osm.conf state=link when: osm_enabled and is_debuntu -- name: Debuntu - Remove the link from sites-enabled to sites-available +- name: Remove the link from sites-enabled to sites-available (debuntu) file: dest=/etc/apache2/sites-enabled/osm.conf state=absent when: not osm_enabled and is_debuntu -- name: Redhat - Remove the osm.conf +- name: Remove the osm.conf (redhat) file: dest=/{{ apache_config_dir }}/osm.conf state=absent when: not osm_enabled and is_redhat -- name: All - Remove link to cgi +- name: Remove link to cgi (all OS's) file: dest={{ doc_root }}/osm.wsgi state=absent when: not osm_enabled -- name: All - Create link to cgi +- name: Create link to cgi (all OS's) file: src={{ osm_venv }}/bin/iiab.wsgi dest={{ doc_root }}/osm.wsgi owner=root