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
2018-10-31 05:25:23 +00:00
- name : Create {{ kolibri_home }} (for data) and {{ kolibri_venv_path }} (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 :
2018-07-16 20:19:18 +00:00
- "{{ kolibri_home }}"
2018-09-01 21:35:25 +00:00
- "{{ kolibri_venv_path }}"
2018-07-15 17:36:05 +00:00
2018-10-31 05:25:23 +00:00
- name : Install latest kolibri using pip
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
2018-07-15 17:36:05 +00:00
when : internet_available
2018-10-31 05:25:23 +00:00
- name : Run Kolibri migrations
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
when : kolibri_provision
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
when : kolibri_provision
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
when : kolibri_provision
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
2018-07-16 20:57:11 +00:00
- name : Create kolibri systemd service unit file
2018-07-15 17:36:05 +00:00
template :
src : "{{ item.src }}"
dest : "{{ item.dest }}"
mode : "{{ item.mode }}"
owner : root
group : root
with_items :
2018-07-16 20:57:11 +00:00
- { src: 'kolibri.service.j2', dest: '/etc/systemd/system/kolibri.service', mode : '0644' }
2018-09-02 02:58:59 +00:00
- name : Enable & (Re)Start kolibri service
2018-07-16 20:57:11 +00:00
systemd :
2018-09-01 21:35:25 +00:00
name : kolibri
enabled : yes
state : restarted
2018-07-16 20:57:11 +00:00
daemon_reload : yes
2018-09-01 21:35:25 +00:00
when : kolibri_enabled
- name : Disable kolibri service
systemd :
name : kolibri
enabled : no
state : stopped
when : not kolibri_enabled
2018-07-15 17:36:05 +00:00
2018-10-31 05:25:23 +00:00
- name : Add 'kolibri' variable values to {{ iiab_ini_file }}
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 }}"
- option : enabled
value : "{{ kolibri_enabled }}"