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

118 lines
3.7 KiB
YAML
Raw Normal View History

2018-07-16 18:11:07 +00:00
- name: Create Linux user {{ kolibri_user }} and add it to groups {{ apache_user }}, disk
user:
name: "{{ kolibri_user }}"
groups:
2018-07-16 20:23:07 +00:00
- "{{ apache_user }}"
- disk
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)
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-10-31 05:25:23 +00:00
- name: Install latest kolibri using pip
pip:
name: kolibri
2018-09-01 21:35:25 +00:00
virtualenv: "{{ kolibri_venv_path }}"
virtualenv_site_packages: no
state: latest
extra_args: --no-cache-dir
when: internet_available | bool
2018-10-31 05:25:23 +00:00
- name: Run Kolibri migrations
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 | 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
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
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
2018-07-16 20:57:11 +00:00
- name: Create kolibri systemd service unit file
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' }
- { src: 'kolibri.conf.j2', dest: '/etc/apache2/sites-available/kolibri.conf', mode: '0644' }
2018-07-16 20:57:11 +00:00
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
when: kolibri_enabled | bool
2018-09-01 21:35:25 +00:00
# Default: http://box/kolibri
- name: Enable http://box{{ kolibri_url }} with Apache
command: a2ensite kolibri.conf
when: kolibri_enabled | bool
2018-09-01 21:35:25 +00:00
- name: Disable kolibri service
systemd:
name: kolibri
enabled: no
state: stopped
when: not kolibri_enabled
- name: Disable http://box{{ kolibri_url }} with Apache
command: a2dissite kolibri.conf
when: not kolibri_enabled
2019-01-18 08:46:37 +00:00
# {{ apache_service }} is almost always apache2
2019-02-03 01:13:33 +00:00
- name: Restart Apache service ({{ apache_service }})
systemd:
name: "{{ apache_service }}"
state: restarted
2018-10-31 05:25:23 +00:00
- name: Add 'kolibri' variable values to {{ iiab_ini_file }}
ini_file:
2018-10-31 05:25:23 +00:00
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
2018-09-01 21:35:25 +00:00
value: "{{ kolibri_exec_path }}"
- option: kolibri_port
value: "{{ kolibri_http_port }}"
0.3 patch1 (#1377) * expand zim_versions_idx to include menuItem name, mediaCount, articleCount, size * create a stub menuItem if none exists * remember to change consumer of zim_version_idx in iiab-admin * comment out some debugging prints * do not change the name of a variable in iiab.ini * consistent variable names for *_enabled * start work on menus for enabled iiab roles * changes to display cups in home menu * remove reference to admin console which may not be installed * print error message * dict.get errors * handle undefined menuItem" * handle undefined menuItem again * some work on logos * break out the zim_versions_idx routines for use by update_menus in admin-console * remove old menuDef creation code * new variable names for zim_versions_idx * missing the tags data in zim_versions_idx * un-break-apart iiab-make-kiwix-lib.py * return an empty string * make size human_readable * getting console and iiab to work together on menus * add the new zim_date field to zim_versions_idx * get the latest into repo * found lost code iiab-make-kiwix-lib.py * Create Lokole admin user during setup * Add requested content to lokole readme Per iiab/iiab#1293 * Update default password * Add Lokole-IIAB user manual * Update default_vars.yml * Update local_vars_min.yml * Update local_vars_min.yml * Update local_vars_medium.yml * Update local_vars_min.yml * Update default_vars.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update default_vars.yml * Update default_vars.yml * Update local_vars_min.yml * Update local_vars_medium.yml * Update local_vars_big.yml * Update default_vars.yml * Update default_vars.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update local_vars_min.yml * Update default_vars.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update local_vars_min.yml * Change admin username to uppercase * Revert "Lokole: change admin to Admin per IIAB app norms" * Update main.yml * Update README.rst * Update capture-wsgi.py * Update main.yml * Update main.yml * Update default_vars.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update local_vars_min.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update default_vars.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update local_vars_min.yml * Address TODOs in Lokole documentation See https://github.com/ascoderu/opwen-webapp/issues/81 * Update main.yml * Update local_vars_big.yml * Update local_vars_medium.yml * Update local_vars_big.yml * Update local_vars_min.yml * Update default_vars.yml * expand zim_versions_idx to include menuItem name, mediaCount, articleCount, size * create a stub menuItem if none exists * remember to change consumer of zim_version_idx in iiab-admin * comment out some debugging prints * do not change the name of a variable in iiab.ini * consistent variable names for *_enabled * start work on menus for enabled iiab roles * changes to display cups in home menu * remove reference to admin console which may not be installed * print error message * dict.get errors * handle undefined menuItem" * handle undefined menuItem again * some work on logos * break out the zim_versions_idx routines for use by update_menus in admin-console * remove old menuDef creation code * new variable names for zim_versions_idx * missing the tags data in zim_versions_idx * un-break-apart iiab-make-kiwix-lib.py * return an empty string * make size human_readable * getting console and iiab to work together on menus * add the new zim_date field to zim_versions_idx * get the latest into repo * found lost code iiab-make-kiwix-lib.py
2019-01-10 22:26:47 +00:00
- option: kolibri_enabled
value: "{{ kolibri_enabled }}"