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

131 lines
4.4 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
- name: Create {{ kolibri_home }} (for data) and {{ kolibri_venv_path }} (venv for program/config)
file:
path: "{{ item }}"
owner: "{{ kolibri_user }}"
group: "{{ apache_user }}"
mode: 0755
state: directory
with_items:
- "{{ kolibri_home }}" # /library/kolibri
- "{{ kolibri_venv_path }}" # /usr/local/kolibri
- name: Install latest Kolibri using pip, to venv
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 and not (kolibri_version is defined)
- name: Install Kolibri {{ kolibri_version }} using pip, to venv
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
- 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?)
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
when: kolibri_provision | bool
2018-09-23 05:00:22 +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
state: started
when: kolibri_enabled | bool
2018-09-01 21:35:25 +00:00
- name: Enable http://box{{ kolibri_url }} with Apache (a2ensite) if kolibri_enabled # i.e. http://box/kolibri
command: a2ensite kolibri.conf
when: kolibri_enabled | bool
- 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
- name: Disable http://box{{ kolibri_url }} with Apache (a2dissite) if not kolibri_enabled
command: a2dissite kolibri.conf
when: not kolibri_enabled
- name: Restart Apache service ({{ apache_service }}) # e.g. apache2
systemd:
name: "{{ apache_service }}"
state: restarted
- name: Add 'kolibri' variable values to {{ iiab_ini_file }} # /etc/iiab/iiab.ini
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 }}"