2019-09-30 03:15:45 +00:00
- name : Create Linux user '{{ kolibri_user }}' and add it to groups '{{ apache_user }}', 'disk'
2018-07-15 17:36:05 +00:00
user :
name : "{{ kolibri_user }}"
groups :
2018-07-16 20:23:07 +00:00
- "{{ apache_user }}"
- disk
2018-07-15 17:36:05 +00:00
state : present
shell : /bin/false
system : yes
create_home : no
2019-09-30 04:12:53 +00:00
- name : Create {{ kolibri_home }} (for Kolibri content, configuration, sqlite3 databases)
2018-07-15 17:36:05 +00:00
file :
2019-09-26 23:48:41 +00:00
path : "{{ kolibri_home }}" # /library/kolibri
2019-09-30 03:15:45 +00:00
owner : "{{ kolibri_user }}" # kolibri
2019-09-26 23:48:41 +00:00
group : "{{ apache_user }}" # www-data (on Debian/Ubuntu/Raspbian)
2018-07-15 17:36:05 +00:00
mode : 0755
state : directory
2019-09-30 03:15:45 +00:00
2019-09-30 04:12:53 +00:00
- name : Create /etc/kolibri
2019-09-30 03:15:45 +00:00
file :
name : /etc/kolibri
state : directory
owner : root
group : root
mode : 0755
- name : Save kolibri_user ({{ kolibri_user }}) to /etc/kolibri/username
copy :
content : "{{ kolibri_user }}"
dest : /etc/kolibri/username
owner : root
group : root
mode : 0644
2019-10-02 00:45:46 +00:00
- name : Save kolibri_home (KOLIBRI_HOME="{{ kolibri_home }}") to /etc/kolibri/daemon.conf
copy :
content : 'KOLIBRI_HOME="{{ kolibri_home }}"'
dest : /etc/kolibri/daemon.conf
owner : root
group : root
mode : 0644
2018-07-15 17:36:05 +00:00
2019-09-26 23:37:28 +00:00
- name : apt install latest Kolibri .deb from {{ kolibri_deb_url }}
2019-09-26 22:50:33 +00:00
apt :
2019-09-26 23:37:28 +00:00
deb : "{{ kolibri_deb_url }}" # https://learningequality.org/r/kolibri-deb-latest
2019-09-30 03:15:45 +00:00
environment :
KOLIBRI_HOME : "{{ kolibri_home }}" # these don't do a thing for now but
KOLIBRI_USER : "{{ kolibri_user }}" # both can't hurt & Might Help Later
2019-09-26 23:37:28 +00:00
when : internet_available | bool
2019-09-26 22:50:33 +00:00
2019-07-07 02:40:46 +00:00
- name: 'Install from templates : kolibri.service unit file for systemd & sites-available/kolibri.conf for Apache'
template :
src : "{{ item.src }}"
dest : "{{ item.dest }}"
owner : root
group : root
2019-07-07 02:52:29 +00:00
mode : 0644
2019-07-07 02:40:46 +00:00
with_items :
2019-07-07 02:52:29 +00:00
- { src: 'kolibri.service.j2', dest : '/etc/systemd/system/kolibri.service' }
- { src: 'kolibri.conf.j2', dest : '/etc/apache2/sites-available/kolibri.conf' }
2019-07-07 02:40:46 +00:00
- name : Enable 'kolibri' systemd service (for reboots) but ensure it's stopped for Kolibri provisioning
systemd :
name : kolibri
daemon_reload : yes
enabled : yes
state : stopped
2019-09-28 00:09:01 +00:00
2019-10-02 00:45:46 +00:00
# 2019-10-01: Should no longer be nec, thanks to /etc/kolibri/daemon.conf
# containing KOLIBRI_HOME="/library/kolibri" (above)
#- name: Run Kolibri migrations to begin populating {{ kolibri_home }} # i.e. /library/kolibri
# shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" manage migrate
# ignore_errors: yes
# become: yes
# become_user: "{{ kolibri_user }}"
# when: kolibri_provision | bool
2018-09-23 05:00:22 +00:00
2019-10-02 00:45:46 +00:00
- name : Set Kolibri default language ({{ kolibri_language }})
2018-09-23 05:00:22 +00:00
shell : export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" language setdefault "{{ kolibri_language }}"
ignore_errors : yes
2019-09-27 21:10:02 +00:00
become : yes
become_user : "{{ kolibri_user }}"
2019-09-30 03:15:45 +00:00
when : kolibri_provision | bool
2018-09-23 05:00:22 +00:00
2019-10-07 00:53:40 +00:00
- name: Provision Kolibri, while setting : facility name, admin acnt / password, preset type, and language
2018-09-23 05:00:22 +00:00
shell : >
export KOLIBRI_HOME="{{ kolibri_home }}" &&
"{{ kolibri_exec_path }}" manage provisiondevice --facility "{{ kolibri_facility }}"
--superusername "{{ kolibri_admin_user }}" --superuserpassword "{{ kolibri_admin_password }}"
2019-10-02 00:45:46 +00:00
--preset "{{ kolibri_preset }}" --language_id "{{ kolibri_language }}"
#--preset "{{ kolibri_preset }}" --language_id "{{ kolibri_language }}" --verbosity 0 --noinput
2018-09-23 05:00:22 +00:00
ignore_errors : yes
2019-09-27 21:10:02 +00:00
become : yes
become_user : "{{ kolibri_user }}"
2019-09-30 03:15:45 +00:00
when : kolibri_provision | bool
2018-09-23 05:00:22 +00:00
2019-09-30 03:15:45 +00:00
- name : chown -R {{ kolibri_user }}:{{ apache_user }} {{ kolibri_home }} for good measure?
2018-09-23 05:00:22 +00:00
file :
2019-09-27 00:14:32 +00:00
path : "{{ kolibri_home }}" # /library/kolibri
2019-09-30 03:15:45 +00:00
owner : "{{ kolibri_user }}" # kolibri
2019-09-27 00:14:32 +00:00
group : "{{ apache_user }}" # www-data (on Debian/Ubuntu/Raspbian)
2018-09-23 05:00:22 +00:00
recurse : yes
2019-07-07 02:40:46 +00:00
when : kolibri_provision | bool
2018-09-23 05:00:22 +00:00
2019-09-30 03:15:45 +00:00
# 2019-09-29: roles/kiwix/tasks/kiwix_install.yml installs 4 Apache modules
# for similar purposes (not all nec?) Only 1 (proxy_http) is needed here.
- name : Enable Apache module proxy_http for http://box{{ kolibri_url }} # i.e. http://box/kolibri
apache2_module :
name : proxy_http
2019-07-07 02:40:46 +00:00
- name : Start 'kolibri' systemd service, if kolibri_enabled
2018-07-16 20:57:11 +00:00
systemd :
2018-09-01 21:35:25 +00:00
name : kolibri
2019-07-07 02:40:46 +00:00
state : started
2019-05-24 22:33:10 +00:00
when : kolibri_enabled | bool
2018-09-01 21:35:25 +00:00
2019-07-07 02:40:46 +00:00
- name : Enable http://box{{ kolibri_url }} with Apache (a2ensite) if kolibri_enabled # i.e. http://box/kolibri
2019-01-16 11:48:30 +00:00
command : a2ensite kolibri.conf
2019-05-24 22:33:10 +00:00
when : kolibri_enabled | bool
2019-01-16 11:48:30 +00:00
2019-07-07 02:40:46 +00:00
- name : Disable & Stop 'kolibri' systemd service if not kolibri_enabled
2018-09-01 21:35:25 +00:00
systemd :
name : kolibri
enabled : no
state : stopped
when : not kolibri_enabled
2018-07-15 17:36:05 +00:00
2019-07-07 02:40:46 +00:00
- name : Disable http://box{{ kolibri_url }} with Apache (a2dissite) if not kolibri_enabled
2019-01-16 11:48:30 +00:00
command : a2dissite kolibri.conf
when : not kolibri_enabled
2019-07-07 02:40:46 +00:00
- name : Restart Apache service ({{ apache_service }}) # e.g. apache2
2019-01-18 08:33:45 +00:00
systemd :
name : "{{ apache_service }}"
state : restarted
2019-07-07 02:40:46 +00:00
- name : Add 'kolibri' variable values to {{ iiab_ini_file }} # /etc/iiab/iiab.ini
2018-07-15 17:36:05 +00:00
ini_file :
2018-10-31 05:25:23 +00:00
path : "{{ iiab_ini_file }}"
2018-07-15 17:36:05 +00:00
section : kolibri
option : "{{ item.option }}"
value : "{{ item.value }}"
with_items :
- option : name
value : kolibri
- option : description
value : '"Kolibri is an open-source educational platform specially designed to provide offline access to a wide range of quality, openly licensed educational contents in low-resource contexts like rural schools, refugee camps, orphanages, and also in non-formal school programs."'
- option : kolibri_url
value : "{{ kolibri_url }}"
2019-09-28 04:58:13 +00:00
- option : kolibri_exec_path
2018-09-01 21:35:25 +00:00
value : "{{ kolibri_exec_path }}"
2019-09-28 04:58:13 +00:00
- option : kolibri_http_port
2018-07-15 17:36:05 +00:00
value : "{{ kolibri_http_port }}"
2019-01-10 22:26:47 +00:00
- option : kolibri_enabled
2018-07-15 17:36:05 +00:00
value : "{{ kolibri_enabled }}"