mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 03:32:12 +00:00
guarantee library.xml exists; re-order for readability
This commit is contained in:
parent
3bd6659178
commit
c14d62beb4
1 changed files with 40 additions and 35 deletions
|
@ -10,17 +10,12 @@
|
|||
- "{{ kiwix_content_path }}"
|
||||
- "{{ iiab_zim_path }}/index"
|
||||
|
||||
- name: Check for 'kiwix-serve' binary
|
||||
- name: Check for /library/zims/library.xml
|
||||
stat:
|
||||
path: "{{ iiab_base }}/kiwix/bin/kiwix-serve"
|
||||
register: kiwix_bin
|
||||
path: "{{ kiwix_library_xml }}"
|
||||
register: kiwix_xml
|
||||
|
||||
- name: Set kiwix_first_pass
|
||||
set_fact:
|
||||
kiwix_first_pass: True
|
||||
when: kiwix_bin.stat.exists is defined and not kiwix_bin.stat.exists
|
||||
|
||||
- name: Copy Kiwix library file if needed
|
||||
- name: Place a stub /library/zims/library.xml if file does not exist
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ kiwix_library_xml }}"
|
||||
|
@ -30,7 +25,17 @@
|
|||
force: no
|
||||
with_items:
|
||||
- library.xml
|
||||
when: kiwix_first_pass
|
||||
when: not kiwix_xml.stat.exists
|
||||
|
||||
- name: Check for /opt/iiab/kiwix/bin/kiwix-serve binary
|
||||
stat:
|
||||
path: "{{ iiab_base }}/kiwix/bin/kiwix-serve"
|
||||
register: kiwix_bin
|
||||
|
||||
- name: Set kiwix_first_pass if kiwix-serve not found
|
||||
set_fact:
|
||||
kiwix_first_pass: True
|
||||
when: kiwix_bin.stat.exists is defined and not kiwix_bin.stat.exists
|
||||
|
||||
- name: Copy test.zim file
|
||||
copy:
|
||||
|
@ -70,16 +75,6 @@
|
|||
shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/"
|
||||
when: not kiwix_src_bin_only and kiwix_first_pass
|
||||
|
||||
- name: Enable the mods which permit Apache to proxy (debuntu)
|
||||
apache2_module:
|
||||
name: "{{ item }}"
|
||||
with_items:
|
||||
- proxy
|
||||
- proxy_html
|
||||
- proxy_http
|
||||
- rewrite
|
||||
when: is_debuntu
|
||||
|
||||
- name: Unarchive Kiwix to permanent location (bin_only, i.e. not i686)
|
||||
unarchive:
|
||||
src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
|
||||
|
@ -98,6 +93,16 @@
|
|||
# recurse: yes
|
||||
# mode: ????
|
||||
|
||||
- name: Enable the mods which permit Apache to proxy (debuntu)
|
||||
apache2_module:
|
||||
name: "{{ item }}"
|
||||
with_items:
|
||||
- proxy
|
||||
- proxy_html
|
||||
- proxy_http
|
||||
- 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
|
||||
|
@ -130,7 +135,21 @@
|
|||
- { 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: Add 'kiwix-serve' to list of services
|
||||
- name: Enable 'kiwix-serve' service
|
||||
service:
|
||||
name: kiwix-serve
|
||||
enabled: yes
|
||||
state: restarted
|
||||
when: kiwix_enabled
|
||||
|
||||
- name: Disable 'kiwix-serve' service
|
||||
service:
|
||||
name: kiwix-serve
|
||||
enabled: no
|
||||
state: stopped
|
||||
when: not kiwix_enabled
|
||||
|
||||
- name: Add 'kiwix-serve' to list of services at /opt/iiab/iiab.ini
|
||||
ini_file:
|
||||
dest: "{{ service_filelist }}"
|
||||
section: kiwix-serve
|
||||
|
@ -156,17 +175,3 @@
|
|||
value: "{{ kiwix_content_path }}"
|
||||
- option: enabled
|
||||
value: "{{ kiwix_enabled }}"
|
||||
|
||||
- name: Enable 'kiwix-serve' service
|
||||
service:
|
||||
name: kiwix-serve
|
||||
enabled: yes
|
||||
state: restarted
|
||||
when: kiwix_enabled
|
||||
|
||||
- name: Disable 'kiwix-serve' service
|
||||
service:
|
||||
name: kiwix-serve
|
||||
enabled: no
|
||||
state: stopped
|
||||
when: not kiwix_enabled
|
||||
|
|
Loading…
Reference in a new issue