2019-09-05 05:16:40 +00:00
|
|
|
- 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
|
|
|
|
|
2021-07-06 19:26:01 +00:00
|
|
|
- name: Create directory {{ kolibri_home }} for Kolibri content, configuration, sqlite3 databases ({{ kolibri_user }}:{{ apache_user }}, by default 0755)
|
2019-09-05 05:16:40 +00:00
|
|
|
file:
|
2020-02-03 02:16:26 +00:00
|
|
|
state: directory
|
2019-09-05 05:16:40 +00:00
|
|
|
path: "{{ kolibri_home }}" # /library/kolibri
|
|
|
|
owner: "{{ kolibri_user }}" # kolibri
|
|
|
|
group: "{{ apache_user }}" # www-data (on Debian/Ubuntu/Raspbian)
|
|
|
|
|
2021-07-06 19:26:01 +00:00
|
|
|
- name: Create directory /etc/kolibri (by default 0755)
|
2019-09-05 05:16:40 +00:00
|
|
|
file:
|
|
|
|
state: directory
|
2020-02-03 02:16:26 +00:00
|
|
|
name: /etc/kolibri
|
2019-09-05 05:16:40 +00:00
|
|
|
|
|
|
|
- name: Save kolibri_user ({{ kolibri_user }}) to /etc/kolibri/username
|
|
|
|
copy:
|
|
|
|
content: "{{ kolibri_user }}"
|
|
|
|
dest: /etc/kolibri/username
|
|
|
|
|
|
|
|
- name: Save kolibri_home (KOLIBRI_HOME="{{ kolibri_home }}") to /etc/kolibri/daemon.conf
|
|
|
|
copy:
|
|
|
|
content: 'KOLIBRI_HOME="{{ kolibri_home }}"'
|
|
|
|
dest: /etc/kolibri/daemon.conf
|
|
|
|
|
|
|
|
- name: apt install latest Kolibri .deb from {{ kolibri_deb_url }} (populates {{ kolibri_home }}, migrates database) # i.e. /library/kolibri
|
|
|
|
apt:
|
|
|
|
deb: "{{ kolibri_deb_url }}" # https://learningequality.org/r/kolibri-deb-latest
|
|
|
|
environment:
|
|
|
|
KOLIBRI_HOME: "{{ kolibri_home }}" # these don't do a thing for now but
|
|
|
|
KOLIBRI_USER: "{{ kolibri_user }}" # both can't hurt & Might Help Later
|
2020-10-16 20:46:19 +00:00
|
|
|
when: internet_available
|
2019-09-05 05:16:40 +00:00
|
|
|
|
2020-05-17 03:50:22 +00:00
|
|
|
- name: 'Install from template: /etc/systemd/system/kolibri.service'
|
2019-09-05 05:16:40 +00:00
|
|
|
template:
|
2020-05-17 03:50:22 +00:00
|
|
|
src: kolibri.service.j2
|
|
|
|
dest: /etc/systemd/system/kolibri.service
|
|
|
|
|
2020-02-03 02:16:26 +00:00
|
|
|
- name: Stop 'kolibri' systemd service, for Kolibri provisioning (after daemon_reload)
|
2019-09-05 05:16:40 +00:00
|
|
|
systemd:
|
|
|
|
name: kolibri
|
|
|
|
daemon_reload: yes
|
|
|
|
state: stopped
|
|
|
|
|
|
|
|
|
|
|
|
# 2019-10-01: Should no longer be nec, thanks to /etc/kolibri/daemon.conf
|
|
|
|
# containing KOLIBRI_HOME="/library/kolibri" (above)
|
|
|
|
#- name: Run Kolibri migrations to begin populating {{ kolibri_home }} # i.e. /library/kolibri
|
|
|
|
# shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" manage migrate
|
|
|
|
# ignore_errors: yes
|
|
|
|
# become: yes
|
|
|
|
# become_user: "{{ kolibri_user }}"
|
2020-10-16 20:46:19 +00:00
|
|
|
# when: kolibri_provision
|
2019-09-05 05:16:40 +00:00
|
|
|
|
2020-01-05 20:18:27 +00:00
|
|
|
# 2020-01-05: Deprecated per https://github.com/iiab/iiab/issues/2103
|
|
|
|
#- name: Set Kolibri default language ({{ kolibri_language }})
|
|
|
|
# shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" language setdefault "{{ kolibri_language }}"
|
|
|
|
# ignore_errors: yes
|
|
|
|
# become: yes
|
|
|
|
# become_user: "{{ kolibri_user }}"
|
2020-10-16 20:46:19 +00:00
|
|
|
# when: kolibri_provision
|
2019-09-05 05:16:40 +00:00
|
|
|
|
|
|
|
- name: 'Provision Kolibri, while setting: facility name, admin acnt / password, preset type, 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 }}"
|
|
|
|
#--preset "{{ kolibri_preset }}" --language_id "{{ kolibri_language }}" --verbosity 0 --noinput
|
|
|
|
ignore_errors: yes
|
|
|
|
become: yes
|
|
|
|
become_user: "{{ kolibri_user }}"
|
2020-10-16 20:46:19 +00:00
|
|
|
when: kolibri_provision
|
2019-09-05 05:16:40 +00:00
|
|
|
|
|
|
|
- name: chown -R {{ kolibri_user }}:{{ apache_user }} {{ kolibri_home }} for good measure?
|
|
|
|
file:
|
|
|
|
path: "{{ kolibri_home }}" # /library/kolibri
|
|
|
|
owner: "{{ kolibri_user }}" # kolibri
|
|
|
|
group: "{{ apache_user }}" # www-data (on Debian/Ubuntu/Raspbian)
|
|
|
|
recurse: yes
|
2020-10-16 20:46:19 +00:00
|
|
|
when: kolibri_provision
|
2019-09-05 05:16:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
# 2019-10-07: Moved to roles/httpd/tasks/main.yml
|
|
|
|
# 2019-09-29: roles/kiwix/tasks/kiwix_install.yml installs 4 Apache modules
|
|
|
|
# for similar purposes (not all nec?) Only 1 (proxy_http) is needed here.
|
|
|
|
#- name: Enable Apache module proxy_http for http://box{{ kolibri_url }} # i.e. http://box/kolibri
|
|
|
|
# apache2_module:
|
|
|
|
# name: proxy_http
|
|
|
|
|
2020-01-30 09:00:00 +00:00
|
|
|
|
|
|
|
# RECORD Kolibri AS INSTALLED
|
|
|
|
|
|
|
|
- name: "Set 'kolibri_installed: True'"
|
|
|
|
set_fact:
|
|
|
|
kolibri_installed: True
|
|
|
|
|
2020-01-12 23:15:33 +00:00
|
|
|
- name: "Add 'kolibri_installed: True' to {{ iiab_state_file }}"
|
2019-09-09 17:14:13 +00:00
|
|
|
lineinfile:
|
2020-02-04 00:54:04 +00:00
|
|
|
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
2019-09-09 17:14:13 +00:00
|
|
|
regexp: '^kolibri_installed'
|
2019-10-07 17:11:21 +00:00
|
|
|
line: 'kolibri_installed: True'
|