1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/kolibri/tasks/enable.yml

71 lines
2.3 KiB
YAML

- name: Enable & Start 'kolibri' systemd service
systemd:
name: kolibri
daemon_reload: yes
enabled: yes
state: started
when: kolibri_enabled | bool
- name: Disable & Stop 'kolibri' systemd service
systemd:
name: kolibri
enabled: no
state: stopped
when: not kolibri_enabled
# Apache
- name: Enable http://box{{ kolibri_url }} via Apache # i.e. http://box/kolibri
command: a2ensite kolibri.conf
when: apache_install and kolibri_enabled
- name: Disable http://box{{ kolibri_url }} via Apache
command: a2dissite kolibri.conf
when: apache_install and not kolibri_enabled
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
state: restarted
when: apache_enabled | bool
# NGINX
- name: Enable http://box{{ kolibri_url }} via NGINX, by installing {{ nginx_config_dir }}/kolibri-nginx.conf from template
template:
src: kolibri-nginx.conf.j2
dest: "{{ nginx_config_dir }}/kolibri-nginx.conf"
when: nginx_install and kolibri_enabled
- name: Disable http://box{{ kolibri_url }} via NGINX, by removing {{ nginx_config_dir }}/kolibri-nginx.conf
file:
path: "{{ nginx_config_dir }}/kolibri-nginx.conf"
state: absent
when: nginx_install and not kolibri_enabled
- name: Restart 'nginx' systemd service
systemd:
name: nginx
state: restarted
when: nginx_enabled | bool
- name: Add 'kolibri' variable values to {{ iiab_ini_file }} # /etc/iiab/iiab.ini
ini_file:
path: "{{ iiab_ini_file }}"
section: kolibri
option: "{{ item.option }}"
value: "{{ item.value | string }}"
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: kolibri_enabled
value: "{{ kolibri_enabled }}"