1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

Merge pull request #903 from arky/master

Add Kolibri role for IIAB 6.6 Preview
This commit is contained in:
A Holt 2018-07-16 10:44:38 -04:00 committed by GitHub
commit 6b2ac56a03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 212 additions and 0 deletions

65
roles/kolibri/README.rst Normal file
View file

@ -0,0 +1,65 @@
==============
Kolibri README
==============
This role install Kolibri, 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.
Access
------
If enabled and with the default settings Kolibri should be accessible at http://box:8009/
To login to Kolibri enter
User Name: Admin
Password: changeme
Configuration Parameters
------------------------
Please look in defaults/main.yml for the default values of the various install parameters. Everything
in this readme assumes the default values.
Automatic Device Provisioning
-----------------------------
When kolibri_provision is enabled, the installation will setup the following settings:
Kolibri Facility name: 'Kolibri-in-a-Box'
Kolibri Preset type: formal (Other options are nonformal, informal)
Kolibri default language: en (Otherwise language are ar,bn-bd,en,es-es,fa,fr-fr,hi-in,mr,nyn,pt-br,sw-tz,ta,te,ur-pk,yo,zu)
Kolibri Admin User: Admin
Kolibri Admin password: changeme
Cloning content
---------------
In Kolibri 0.10 introduced `kolibri manage deprovision` which will remove
user configuration, leaving content intact. You can then copy/clone /library/kolibri
to a new location.
Trouble Shooting
----------------
You can run the server manually with the following commands:
systemctl stop kolibri (make sure the systemd service is not running)
export KOLIBRI_HOME=/library/kolibri
export KOLIBRI_HTTP_PORT=8009 (other Kolibri will run on default port 8080)
kolibri start
To return to using the systemd unit:
kolibri stop
systemctl start kolibri

View file

@ -0,0 +1,34 @@
# The values here are defaults.
# To override them edit the main var definitions in iiab/vars
# Installation Variables
kolibri_install: True
kolibri_enabled: True
# Kolibri folder to store its data and configuration files.
kolibri_home: "{{ content_base }}/kolibri"
kolibri_http_port: 8009
kolibri_url: /kolibri/
kolibri_path: "{{ iiab_base }}/kolibri"
kolibri_exec_path: /usr/local/bin/kolibri
# Kolibri system user
kolibri_user: kolibri
# Kolibri setup will be provisioned with default administration account, preset and
# language. You could turn this to 'False' while reinstalling kolibri.
kolibri_provision: True
# Kolibri Facility name
kolibri_facility: 'Kolibri-in-a-Box'
# Kolibri Preset type: formal, nonformal, informal
kolibri_preset: 'formal'
# Kolibri default language (ar,bn-bd,en,es-es,fa,fr-fr,hi-in,mr,nyn,pt-br,sw-tz,ta,te,ur-pk,yo,zu)
kolibri_language: 'en'
# Kolibri admin account
kolibri_admin_user: 'Admin'
kolibri_admin_password: 'changeme'

View file

@ -0,0 +1,97 @@
---
- name: Create a Kolibri system user and to www-data, disk groups
user:
name: "{{ kolibri_user }}"
groups:
- "{{ apache_user }}"
- disk
state: present
shell: /bin/false
system: yes
create_home: no
- name: Create Kolibri folder to store data and configuration files.
file:
path: "{{ item }}"
owner: "{{ kolibri_user }}"
group: "{{ apache_user }}"
mode: 0755
state: directory
with_items:
- "{{ kolibri_home }}"
- name: Install kolibri using pip on all OS's
pip:
name: kolibri
state: latest
when: internet_available
- name: Create kolibri systemd service file
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' }
- name: Set kolibri default language.
shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" language setdefault "{{ kolibri_language }}"
ignore_errors: yes
when: kolibri_provision
- name: Create kolibri default facility name, admin account and language.
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
- name: Change /library/kolibri directory permissions.
file:
path: "{{ kolibri_home }}"
owner: "{{ kolibri_user }}"
group: "{{ apache_user }}"
recurse: yes
- name: Enable kolibri service.
service:
name: "{{ item.name }}"
enabled: yes
state: restarted
with_items:
- { name: kolibri }
when: kolibri_enabled
- name: Disable kolibri service.
service:
name: "{{ item.name }}"
enabled: no
state: stopped
with_items:
- { name: kolibri }
when: not kolibri_enabled
- name: Add 'kolibri' to list of services at /etc/iiab/iiab.ini
ini_file:
dest: "{{ service_filelist }}"
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
value: "{{ kolibri_path }}"
- option: kolibri_port
value: "{{ kolibri_http_port }}"
- option: enabled
value: "{{ kolibri_enabled }}"

View file

@ -0,0 +1,16 @@
[Unit]
Description=Kolibri
[Service]
Type=oneshot
RemainAfterExit=yes
Environment=KOLIBRI_USER={{ kolibri_user }}
Environment=KOLIBRI_HOME={{ kolibri_home }}
Environment=KOLIBRI_HTTP_PORT={{ kolibri_http_port }}
User={{ kolibri_user }}
Group={{ apache_user }}
ExecStart={{ kolibri_exec_path }} start
ExecStop={{ kolibri_exec_path }} stop
[Install]
WantedBy=multi-user.target