2017-11-27 03:33:05 +00:00
|
|
|
# 1. CREATE/VERIFY CRITICAL DIRECTORIES & FILES ARE IN PLACE
|
2020-01-11 17:38:37 +00:00
|
|
|
|
2019-10-16 05:39:27 +00:00
|
|
|
- name: Download Kiwix software to /opt/iiab/downloads
|
|
|
|
get_url:
|
|
|
|
url: "{{ iiab_download_url }}/{{ kiwix_src_file }}"
|
|
|
|
dest: "{{ downloads_dir }}/{{ kiwix_src_file }}"
|
|
|
|
timeout: "{{ download_timeout }}"
|
|
|
|
when: internet_available | bool
|
|
|
|
|
|
|
|
- name: Check for /opt/iiab/downloads/{{ kiwix_src_file }}
|
|
|
|
stat:
|
|
|
|
path: "{{ downloads_dir }}/{{ kiwix_src_file }}"
|
|
|
|
register: kiwix_src
|
2017-11-27 03:33:05 +00:00
|
|
|
|
2018-10-31 05:42:27 +00:00
|
|
|
- name: Create directory {{ iiab_zim_path }} and subdirs {content, index} for Kiwix ZIM files
|
2017-11-25 22:12:26 +00:00
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
2017-05-27 18:09:50 +00:00
|
|
|
with_items:
|
2019-09-30 03:03:59 +00:00
|
|
|
- "{{ iiab_zim_path }}"
|
|
|
|
- "{{ iiab_zim_path }}/content"
|
|
|
|
- "{{ iiab_zim_path }}/index"
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-31 05:42:27 +00:00
|
|
|
- name: Check for {{ kiwix_library_xml }} # /library/zims/library.xml
|
2017-11-25 22:12:26 +00:00
|
|
|
stat:
|
2017-11-26 15:38:48 +00:00
|
|
|
path: "{{ kiwix_library_xml }}"
|
|
|
|
register: kiwix_xml
|
2017-09-11 16:21:07 +00:00
|
|
|
|
2020-01-11 17:38:37 +00:00
|
|
|
- name: Install stub /library/zims/library.xml from template, if one doesn't exist
|
2017-11-25 22:12:26 +00:00
|
|
|
template:
|
2019-09-30 03:03:59 +00:00
|
|
|
src: library.xml
|
2017-11-25 22:12:26 +00:00
|
|
|
dest: "{{ kiwix_library_xml }}"
|
|
|
|
force: no
|
2017-11-26 15:38:48 +00:00
|
|
|
when: not kiwix_xml.stat.exists
|
|
|
|
|
2020-01-11 17:38:37 +00:00
|
|
|
- name: Install {{ iiab_zim_path }}/content/test.zim
|
2017-11-25 22:12:26 +00:00
|
|
|
copy:
|
|
|
|
src: test.zim
|
2017-11-27 03:33:05 +00:00
|
|
|
dest: "{{ iiab_zim_path }}/content/test.zim"
|
2017-11-25 22:12:26 +00:00
|
|
|
force: no
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-31 05:42:27 +00:00
|
|
|
- name: Create {{ kiwix_path }}/bin directory # /opt/iiab/kiwix/bin
|
2017-11-26 16:58:58 +00:00
|
|
|
file:
|
2017-11-27 18:07:28 +00:00
|
|
|
path: "{{ kiwix_path }}/bin"
|
2017-11-26 16:58:58 +00:00
|
|
|
state: directory
|
|
|
|
|
2020-01-30 09:00:00 +00:00
|
|
|
|
2020-01-11 17:38:37 +00:00
|
|
|
# 2. INSTALL KIWIX-TOOLS EXECUTABLES
|
2017-11-26 16:58:58 +00:00
|
|
|
|
2018-10-31 05:42:27 +00:00
|
|
|
- name: Unarchive {{ kiwix_src_file }} to /tmp # e.g. kiwix-tools_linux-armhf-0.6.1-1.tar.gz
|
2017-11-27 03:33:05 +00:00
|
|
|
unarchive:
|
|
|
|
src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
|
|
|
|
dest: /tmp
|
2018-03-27 15:48:56 +00:00
|
|
|
|
2018-07-02 12:26:26 +00:00
|
|
|
- name: Move /tmp/{{ kiwix_src_dir }}/* to permanent location /opt/iiab/kiwix/bin (armhf & linux64 & i686)
|
2018-03-27 16:02:58 +00:00
|
|
|
shell: "mv /tmp/{{ kiwix_src_dir }}/* {{ kiwix_path }}/bin/"
|
2017-11-27 03:33:05 +00:00
|
|
|
|
2020-01-30 09:00:00 +00:00
|
|
|
|
2017-11-27 03:33:05 +00:00
|
|
|
# 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU
|
2017-11-26 16:58:58 +00:00
|
|
|
|
2019-10-07 18:37:17 +00:00
|
|
|
# 2019-10-07: Moved to roles/httpd/tasks/main.yml
|
2019-09-30 07:02:22 +00:00
|
|
|
# 2019-09-29: Compare roles/kolibri/defaults/main.yml using just 1 (proxy_http)
|
2019-10-07 18:37:17 +00:00
|
|
|
#- name: Enable the 4 mods which permit Apache to proxy (debuntu)
|
|
|
|
# apache2_module:
|
|
|
|
# name: "{{ item }}"
|
|
|
|
# with_items:
|
|
|
|
# - proxy
|
|
|
|
# - proxy_html
|
|
|
|
# - proxy_http
|
|
|
|
# - rewrite
|
|
|
|
# when: is_debuntu | bool
|
2017-11-26 15:38:48 +00:00
|
|
|
|
2020-01-30 09:00:00 +00:00
|
|
|
|
2020-01-11 17:38:37 +00:00
|
|
|
# 4. INSTALL iiab-make-kiwix-lib*, kiwix-serve.service, kiwix.conf for Apache
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-31 05:42:27 +00:00
|
|
|
- name: 'Install from templates: kiwix-serve.service, iiab-make-kiwix-lib, iiab-make-kiwix-lib.py, kiwix.conf'
|
2017-11-25 22:12:26 +00:00
|
|
|
template:
|
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "{{ item.dest }}"
|
|
|
|
mode: "{{ item.mode }}"
|
2017-05-27 18:09:50 +00:00
|
|
|
with_items:
|
2020-01-12 00:09:29 +00:00
|
|
|
- { src: 'kiwix-serve.service.j2', dest: '/etc/systemd/system/kiwix-serve.service', mode: '0644' }
|
|
|
|
- { src: 'iiab-make-kiwix-lib', dest: '/usr/bin/iiab-make-kiwix-lib', mode: '0755' }
|
|
|
|
- { src: 'iiab-make-kiwix-lib3.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755' }
|
2020-01-30 09:00:00 +00:00
|
|
|
- { src: 'kiwix.conf.j2', dest: '/etc/{{ apache_conf_dir }}/kiwix.conf', mode: '0644' }
|
|
|
|
|
|
|
|
|
|
|
|
# 5. RECORD Kiwix AS INSTALLED
|
2017-12-02 16:49:25 +00:00
|
|
|
|
2020-01-30 09:00:00 +00:00
|
|
|
- name: "Set 'kiwix_installed: True'"
|
|
|
|
set_fact:
|
|
|
|
kiwix_installed: True
|
2020-01-11 17:38:37 +00:00
|
|
|
|
2020-01-12 23:15:33 +00:00
|
|
|
- name: "Add 'kiwix_installed: True' to {{ iiab_state_file }}"
|
2019-09-09 17:14:13 +00:00
|
|
|
lineinfile:
|
2020-01-12 23:15:33 +00:00
|
|
|
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
2019-09-09 17:14:13 +00:00
|
|
|
regexp: '^kiwix_installed'
|
2019-10-07 17:11:21 +00:00
|
|
|
line: 'kiwix_installed: True'
|