1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #37 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2017-11-27 09:30:01 -05:00 committed by GitHub
commit 1623099849
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 218 additions and 207 deletions

View file

@ -77,13 +77,15 @@
#async: 900
#poll: 5
- name: Add 'calibre-serve' to service list 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: name
value: Calibre
- option: description
value: '"Calibre is an extremely popular personal library system for e-books."'
- option: url

View file

@ -34,14 +34,15 @@
- include_tasks: enable.yml
- name: Add 'kalite-serve' to service list
ini_file: dest='{{ service_filelist }}'
section=kalite
option='{{ item.option }}'
value='{{ item.value }}'
- 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 }}"
with_items:
- option: name
value: kalite
value: "KA Lite"
- option: description
value: '"KA Lite is a server to present Khan Academy videos offline and to download them."'
- option: path

View file

@ -1,25 +1,28 @@
# 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"
# Appears to be kiwix-0.9 from May 2014:
# 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
# The following 2 lines are unused as of Nov 2017:
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:
# kiwix_content_path: "{{ iiab_zim_path }}/content"
# Unused: (Nov 2017)
kiwix_content_path: "{{ iiab_zim_path }}/content"
# Installation variables
# Installation Variables
kiwix_install: True
kiwix_enabled: True
kiwix_first_pass: False
# Unused as of Nov 2017:
# MOVE FILE /opt/iiab/kiwix/bin/kiwix-serve TO FORCE A REINSTALL OF kiwix-tools
kiwix_force_install: False
# Unused: (Nov 2017)
# kiwix_content_found: False

View file

@ -1,5 +1,3 @@
# 1. CREATE/VERIFY CRITICAL DIRECTORIES & FILES ARE IN PLACE
- name: Create various directories for Kiwix's ZIM files
file:
path: "{{ item }}"
@ -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
@ -34,12 +32,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
copy:
src: test.zim
dest: "{{ kiwix_content_path }}/test.zim"
@ -47,9 +45,24 @@
owner: root
group: root
force: no
when: kiwix_first_pass
when: kiwix_force_install
- name: Create /opt/iiab/kiwix/bin directory
# We get a whole web server for i686 but only the kiwix execs for linux64 & armhf
# 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
# dest: "{{ iiab_base }}"
owner: root
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
@ -57,33 +70,18 @@
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
# 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
- 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
# 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)
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
# 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)
shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/"
when: not kiwix_src_bin_only and kiwix_first_pass
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
@ -95,8 +93,6 @@
# recurse: yes
# mode: ????
# 3. ENABLE MODS FOR APACHE PROXY
- name: Enable the mods which permit Apache to proxy (debuntu)
apache2_module:
name: "{{ item }}"
@ -107,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:
@ -124,13 +135,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
@ -138,28 +142,14 @@
state: restarted
when: 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: Disable 'kiwix-serve' service
service:
name: kiwix-serve
enabled: no
state: stopped
when: not kiwix_enabled
- 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
@ -181,8 +171,7 @@
value: "{{ iiab_zim_path }}"
- option: kiwix_library_xml
value: "{{ kiwix_library_xml }}"
# The following 2 lines are unused as of Nov 2017:
# - option: kiwix_content_path
# value: "{{ kiwix_content_path }}"
- option: kiwix_content_path
value: "{{ kiwix_content_path }}"
- option: enabled
value: "{{ kiwix_enabled }}"

View file

@ -1,9 +1,8 @@
# 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:
@ -11,11 +10,18 @@
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 i686 CODE PATH ON X86_64 (WORKS NOV 2017)
- 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
- name: Download Kiwix software to /opt/iiab/downloads
get_url:
@ -23,11 +29,16 @@
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
tags:
- kiwix
- debug:
msg: "WARNING: kiwix-tools SOFTWARE NOT FOUND FOR YOUR OS/ARCHITECTURE."
when: not kiwix_src_file

View file

@ -122,14 +122,15 @@
# following enables and disables
- include_tasks: nextcloud_enabled.yml
- name: Add 'nextcloud' to service list
ini_file: dest='{{ service_filelist }}'
section=nextcloud
option='{{ item.option }}'
value='{{ item.value }}'
- 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 }}"
with_items:
- option: name
value: nextcloud
value: Nextcloud
- option: description
value: '"NextCloud is a local server-based facility for sharing files, photos, contacts, calendars, etc."'
- option: path

View file

@ -102,14 +102,15 @@
when: not openvpn_enabled and not installing
- name: Add OpenVPN to service list
ini_file: dest='{{ service_filelist }}'
section=openvpn
option='{{ item.option }}'
value='{{ item.value }}'
- 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 }}"
with_items:
- option: name
value: "openvpn"
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

View file

@ -137,16 +137,18 @@
service: name={{ apache_service }}
state=restarted
- name: Add OSM to service list
ini_file: dest='{{ service_filelist }}'
section=osm
option='{{ item.option }}'
value='{{ item.value }}'
- 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 }}"
with_items:
- option: name
value: Internet-in-a-Box
value: OpenStreetMap
- 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 worlds Free information."'
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 worlds Free information."'
- option: path
value: /osm
- option: enabled

View file

@ -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

View file

@ -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

View file

@ -123,14 +123,15 @@
- name: Restart Apache, so it picks up the new aliases
service: name={{ apache_service }} state=restarted
- name: Add 'wordpress' to service list
ini_file: dest='{{ service_filelist }}'
section=wordpress
option='{{ item.option }}'
value='{{ item.value }}'
- 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 }}"
with_items:
- option: name
value: wordpress
value: WordPress
- option: description
value: '"WordPress is a blog and web site management application."'
- option: wordpress_src