mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Polish kolibri/tasks/main.yml for .deb install
This commit is contained in:
parent
24cef4f2ce
commit
79b9a8eb91
1 changed files with 33 additions and 73 deletions
|
@ -1,10 +1,4 @@
|
|||
# SEE kolibri_user EXPLANATION IN roles/kolibri/defaults/main.yml
|
||||
- name: Override kolibri_user (e.g. from 'kolibri') to 'pi' if Raspberry Pi / Raspbian
|
||||
set_fact:
|
||||
kolibri_user: pi
|
||||
when: is_rpi | bool
|
||||
|
||||
- name: Create Linux user {{ kolibri_user }} and add it to groups {{ apache_user }}, disk
|
||||
- name: Create Linux user '{{ kolibri_user }}' and add it to groups '{{ apache_user }}', 'disk'
|
||||
user:
|
||||
name: "{{ kolibri_user }}"
|
||||
groups:
|
||||
|
@ -14,58 +8,38 @@
|
|||
shell: /bin/false
|
||||
system: yes
|
||||
create_home: no
|
||||
when: not is_rpi
|
||||
|
||||
#- name: Create {{ kolibri_home }} (for data) and {{ kolibri_venv_path }} (venv for program/config)
|
||||
- name: Create {{ kolibri_home }} (for data)
|
||||
file:
|
||||
path: "{{ kolibri_home }}" # /library/kolibri
|
||||
owner: "{{ kolibri_user }}" # pi or kolibri
|
||||
owner: "{{ kolibri_user }}" # kolibri
|
||||
group: "{{ apache_user }}" # www-data (on Debian/Ubuntu/Raspbian)
|
||||
mode: 0755
|
||||
state: directory
|
||||
# with_items:
|
||||
# - "{{ kolibri_home }}" # /library/kolibri
|
||||
# - "{{ kolibri_venv_path }}" # /usr/local/kolibri
|
||||
|
||||
#- name: Download latest Kolibri .deb installer from {{ kolibri_deb_url }}
|
||||
# get_url:
|
||||
# name: "{{ kolibri_deb_url }}" # https://learningequality.org/r/kolibri-deb-latest
|
||||
# dest: "{{ downloads_dir }}"
|
||||
# timeout: "{{ download_timeout }}"
|
||||
# register: kolibri_download_output
|
||||
# when: internet_available | bool
|
||||
- name: Create /etc/kolibri if nec
|
||||
file:
|
||||
name: /etc/kolibri
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
|
||||
- name: Save kolibri_user ({{ kolibri_user }}) to /etc/kolibri/username
|
||||
copy:
|
||||
content: "{{ kolibri_user }}"
|
||||
dest: /etc/kolibri/username
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: apt install latest Kolibri .deb from {{ kolibri_deb_url }}
|
||||
apt:
|
||||
deb: "{{ kolibri_deb_url }}" # https://learningequality.org/r/kolibri-deb-latest
|
||||
# "Requires the xz-utils package to extract the control file of the deb package to install."
|
||||
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
|
||||
when: internet_available | bool
|
||||
#when: kolibri_download_output.dest is defined and (kolibri_version is undefined)
|
||||
|
||||
#- name: Install Kolibri {{ kolibri_version }} using apt
|
||||
# apt:
|
||||
# #update_cache: yes
|
||||
# name: "kolibri={{ kolibri_version }}"
|
||||
# when: kolibri_download_output.dest is defined and kolibri_version is defined
|
||||
|
||||
#- name: Install latest Kolibri using pip, to venv
|
||||
# pip:
|
||||
# name: kolibri
|
||||
# virtualenv: "{{ kolibri_venv_path }}"
|
||||
# virtualenv_site_packages: no
|
||||
# state: latest
|
||||
# extra_args: --no-cache-dir
|
||||
# when: internet_available and (kolibri_version is undefined)
|
||||
|
||||
#- 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:
|
||||
|
@ -86,19 +60,19 @@
|
|||
state: stopped
|
||||
|
||||
|
||||
- name: Run Kolibri migrations (WHY? WHAT DOES THIS DO?)
|
||||
- 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 }}"
|
||||
when: kolibri_provision and is_rpi
|
||||
when: kolibri_provision | bool
|
||||
|
||||
- name: Set Kolibri default language
|
||||
shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" language setdefault "{{ kolibri_language }}"
|
||||
ignore_errors: yes
|
||||
become: yes
|
||||
become_user: "{{ kolibri_user }}"
|
||||
when: kolibri_provision and is_rpi
|
||||
when: kolibri_provision | bool
|
||||
|
||||
- name: Create Kolibri default facility name, admin account and language
|
||||
shell: >
|
||||
|
@ -109,37 +83,23 @@
|
|||
ignore_errors: yes
|
||||
become: yes
|
||||
become_user: "{{ kolibri_user }}"
|
||||
when: kolibri_provision and is_rpi
|
||||
when: kolibri_provision | bool
|
||||
|
||||
|
||||
- name: Run Kolibri migrations (WHY? WHAT DOES THIS DO?)
|
||||
shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" manage migrate
|
||||
ignore_errors: yes
|
||||
when: kolibri_provision and not is_rpi
|
||||
|
||||
- name: Set Kolibri default language
|
||||
shell: export KOLIBRI_HOME="{{ kolibri_home }}" && "{{ kolibri_exec_path }}" language setdefault "{{ kolibri_language }}"
|
||||
ignore_errors: yes
|
||||
when: kolibri_provision and not is_rpi
|
||||
|
||||
- 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 and not is_rpi
|
||||
|
||||
|
||||
- name: chown -R {{ kolibri_user }}:{{ apache_user }} {{ kolibri_home }}
|
||||
- name: chown -R {{ kolibri_user }}:{{ apache_user }} {{ kolibri_home }} for good measure?
|
||||
file:
|
||||
path: "{{ kolibri_home }}" # /library/kolibri
|
||||
owner: "{{ kolibri_user }}" # pi or kolibri
|
||||
owner: "{{ kolibri_user }}" # kolibri
|
||||
group: "{{ apache_user }}" # www-data (on Debian/Ubuntu/Raspbian)
|
||||
recurse: yes
|
||||
when: kolibri_provision | bool
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
- name: Start 'kolibri' systemd service, if kolibri_enabled
|
||||
systemd:
|
||||
name: kolibri
|
||||
|
|
Loading…
Reference in a new issue