1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/kolibri/tasks/main.yml
2018-10-31 01:25:23 -04:00

101 lines
3.1 KiB
YAML

- name: Create Linux user {{ kolibri_user }} and add it to groups {{ apache_user }}, disk
user:
name: "{{ kolibri_user }}"
groups:
- "{{ apache_user }}"
- disk
state: present
shell: /bin/false
system: yes
create_home: no
- name: Create {{ kolibri_home }} (for data) and {{ kolibri_venv_path }} (for program/config)
file:
path: "{{ item }}"
owner: "{{ kolibri_user }}"
group: "{{ apache_user }}"
mode: 0755
state: directory
with_items:
- "{{ kolibri_home }}"
- "{{ kolibri_venv_path }}"
- name: Install latest kolibri using pip
pip:
name: kolibri
virtualenv: "{{ kolibri_venv_path }}"
virtualenv_site_packages: no
state: latest
extra_args: --no-cache-dir
when: internet_available
- name: Run Kolibri migrations
shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" manage migrate
ignore_errors: yes
when: kolibri_provision
- 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: chown -R {{ kolibri_user }}:{{ apache_user }} {{ kolibri_home }}
file:
path: "{{ kolibri_home }}"
owner: "{{ kolibri_user }}"
group: "{{ apache_user }}"
recurse: yes
- name: Create kolibri systemd service unit 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: Enable & (Re)Start kolibri service
systemd:
name: kolibri
enabled: yes
state: restarted
daemon_reload: yes
when: kolibri_enabled
- name: Disable kolibri service
systemd:
name: kolibri
enabled: no
state: stopped
when: not kolibri_enabled
- name: Add 'kolibri' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"
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_exec_path }}"
- option: kolibri_port
value: "{{ kolibri_http_port }}"
- option: enabled
value: "{{ kolibri_enabled }}"