mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
re-ordered & documentation brightened
This commit is contained in:
parent
dde4020278
commit
324781d51d
1 changed files with 52 additions and 45 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue