mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Update kiwix_install.yml
This commit is contained in:
parent
77ce15a72b
commit
bb2f638e6b
1 changed files with 57 additions and 59 deletions
|
@ -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:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
owner: root
|
owner: root
|
||||||
|
@ -7,7 +9,7 @@
|
||||||
state: directory
|
state: directory
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ iiab_zim_path }}"
|
- "{{ iiab_zim_path }}"
|
||||||
- "{{ kiwix_content_path }}"
|
- "{{ iiab_zim_path }}/content"
|
||||||
- "{{ iiab_zim_path }}/index"
|
- "{{ iiab_zim_path }}/index"
|
||||||
|
|
||||||
- name: Check for /library/zims/library.xml
|
- name: Check for /library/zims/library.xml
|
||||||
|
@ -35,25 +37,38 @@
|
||||||
- name: Set kiwix_force_install if kiwix-serve not found
|
- name: Set kiwix_force_install if kiwix-serve not found
|
||||||
set_fact:
|
set_fact:
|
||||||
kiwix_force_install: True
|
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:
|
copy:
|
||||||
src: test.zim
|
src: test.zim
|
||||||
dest: "{{ kiwix_content_path }}/test.zim"
|
dest: "{{ iiab_zim_path }}/content/test.zim"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
force: no
|
force: no
|
||||||
when: kiwix_force_install
|
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
|
# 2. INSTALL KIWIX-TOOLS EXECUTABLES IF kiwix_force_install
|
||||||
# to /tmp/kiwix-0.10-i686/bin WHOSE CONTENTS NEEDS TO BE MOVED TO
|
# (We get a whole web server for i686 but only kiwix execs for linux64 & armhf)
|
||||||
# /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 binaries to permanent location (NOT i686)
|
||||||
- name: Unarchive kiwix-*-linux-i686.tar.bz2 to /tmp (not bin_only, i.e. 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:
|
unarchive:
|
||||||
src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
|
src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
|
||||||
dest: /tmp
|
dest: /tmp
|
||||||
|
@ -62,36 +77,11 @@
|
||||||
group: root
|
group: root
|
||||||
when: not kiwix_src_bin_only and kiwix_force_install
|
when: not kiwix_src_bin_only and kiwix_force_install
|
||||||
|
|
||||||
- name: Create kiwix/bin directory
|
- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (i686)
|
||||||
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/"
|
shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/"
|
||||||
when: not kiwix_src_bin_only and kiwix_force_install
|
when: not kiwix_src_bin_only and kiwix_force_install
|
||||||
|
|
||||||
- name: Unarchive Kiwix to permanent location (bin_only, i.e. not i686)
|
# 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU
|
||||||
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)
|
- name: Enable the mods which permit Apache to proxy (debuntu)
|
||||||
apache2_module:
|
apache2_module:
|
||||||
|
@ -103,22 +93,7 @@
|
||||||
- rewrite
|
- rewrite
|
||||||
when: is_debuntu
|
when: is_debuntu
|
||||||
|
|
||||||
# workaround because kiwix-serve does not stay running
|
# 4. CREATE/ENABLE/DISABLE KIWIX SERVICE & ITS CRON JOB
|
||||||
- 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
|
- name: Create 'kiwix-serve' service
|
||||||
template:
|
template:
|
||||||
|
@ -148,8 +123,30 @@
|
||||||
enabled: no
|
enabled: no
|
||||||
state: stopped
|
state: stopped
|
||||||
when: not kiwix_enabled
|
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:
|
ini_file:
|
||||||
dest: "{{ service_filelist }}"
|
dest: "{{ service_filelist }}"
|
||||||
section: kiwix-serve
|
section: kiwix-serve
|
||||||
|
@ -160,7 +157,7 @@
|
||||||
value: kiwix-serve
|
value: kiwix-serve
|
||||||
- option: description
|
- option: description
|
||||||
value: '"Part of https://github.com/kiwix/kiwix-tools/ - kiwix-serve is the most used web server for ZIM files."'
|
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
|
# - option: kiwix_url
|
||||||
# value: "{{ kiwix_url }}"
|
# value: "{{ kiwix_url }}"
|
||||||
# - option: kiwix_path
|
# - option: kiwix_path
|
||||||
|
@ -171,7 +168,8 @@
|
||||||
value: "{{ iiab_zim_path }}"
|
value: "{{ iiab_zim_path }}"
|
||||||
- option: kiwix_library_xml
|
- option: kiwix_library_xml
|
||||||
value: "{{ kiwix_library_xml }}"
|
value: "{{ kiwix_library_xml }}"
|
||||||
- option: kiwix_content_path
|
# The following 2 lines are unused: (Nov 2017)
|
||||||
value: "{{ kiwix_content_path }}"
|
# - option: kiwix_content_path
|
||||||
|
# value: "{{ kiwix_content_path }}"
|
||||||
- option: enabled
|
- option: enabled
|
||||||
value: "{{ kiwix_enabled }}"
|
value: "{{ kiwix_enabled }}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue