2018-07-16 18:11:07 +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-07-07 02:40:46 +00:00
- name : Create {{ kolibri_home }} (for data) and {{ kolibri_venv_path }} (venv for program/config)
2018-07-15 17:36:05 +00:00
file :
path : "{{ item }}"
owner : "{{ kolibri_user }}"
group : "{{ apache_user }}"
mode : 0755
state : directory
with_items :
2019-07-07 02:40:46 +00:00
- "{{ kolibri_home }}" # /library/kolibri
- "{{ kolibri_venv_path }}" # /usr/local/kolibri
2018-07-15 17:36:05 +00:00
2019-07-07 02:40:46 +00:00
- name : Install latest Kolibri using pip, to venv
2018-07-15 17:36:05 +00:00
pip :
name : kolibri
2018-09-01 21:35:25 +00:00
virtualenv : "{{ kolibri_venv_path }}"
virtualenv_site_packages : no
2018-07-15 17:36:05 +00:00
state : latest
2018-07-16 19:04:58 +00:00
extra_args : --no -cache-dir
2019-06-13 21:33:52 +00:00
when : internet_available and not (kolibri_version is defined)
2019-07-07 02:40:46 +00:00
- name : Install Kolibri {{ kolibri_version }} using pip, to venv
2019-06-13 21:33:52 +00:00
pip :
name : kolibri
virtualenv : "{{ kolibri_venv_path }}"
virtualenv_site_packages : no
version : "{{ kolibri_version }}"
extra_args : --no -cache-dir
when : internet_available and kolibri_version is defined
2018-07-15 17:36:05 +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 }}"
mode : "{{ item.mode }}"
owner : root
group : root
with_items :
- { src: 'kolibri.service.j2', dest: '/etc/systemd/system/kolibri.service', mode : '0644' }
- { src: 'kolibri.conf.j2', dest: '/etc/apache2/sites-available/kolibri.conf', mode : '0644' }
- 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
- name : Run Kolibri migrations (WHY? WHAT DOES THIS DO?)
2018-09-23 05:17:26 +00:00
shell : export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" manage migrate
2018-09-23 05:00:22 +00:00
ignore_errors : yes
2019-05-24 22:33:10 +00:00
when : kolibri_provision | bool
2018-09-23 05:00:22 +00:00
2018-10-31 05:25:23 +00:00
- name : Set Kolibri default 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-05-24 22:33:10 +00:00
when : kolibri_provision | bool
2018-09-23 05:00:22 +00:00
2018-10-31 05:25:23 +00:00
- name : Create Kolibri default facility name, admin account 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 }}"
--preset "{{ kolibri_preset }}" --language_id "{{ kolibri_language }}" --verbosity 0 --noinput
ignore_errors : yes
2019-05-24 22:33:10 +00:00
when : kolibri_provision | bool
2018-09-23 05:00:22 +00:00
2018-10-31 05:25:23 +00:00
- name : chown -R {{ kolibri_user }}:{{ apache_user }} {{ kolibri_home }}
2018-09-23 05:00:22 +00:00
file :
path : "{{ kolibri_home }}"
owner : "{{ kolibri_user }}"
group : "{{ apache_user }}"
recurse : yes
2019-07-07 02:40:46 +00:00
when : kolibri_provision | bool
2018-09-23 05:00:22 +00:00
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 }}"
- option : kolibri_path
2018-09-01 21:35:25 +00:00
value : "{{ kolibri_exec_path }}"
2018-07-15 17:36:05 +00:00
- option : kolibri_port
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 }}"