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

72 lines
2.3 KiB
YAML
Raw Normal View History

2020-01-11 21:29:20 +00:00
- name: Enable & Start 'kolibri' systemd service
2019-09-05 05:16:40 +00:00
systemd:
name: kolibri
2020-01-11 21:29:20 +00:00
daemon_reload: yes
2019-09-05 05:16:40 +00:00
enabled: yes
2020-01-11 21:29:20 +00:00
state: started
2020-01-11 21:49:06 +00:00
when: kolibri_enabled | bool
2019-09-05 05:16:40 +00:00
2020-01-11 21:29:20 +00:00
- name: Disable & Stop 'kolibri' systemd service
2019-09-05 05:16:40 +00:00
systemd:
name: kolibri
enabled: no
state: stopped
when: not kolibri_enabled
2020-01-11 21:29:20 +00:00
# Apache
- name: Enable http://box{{ kolibri_url }} via Apache # i.e. http://box/kolibri
command: a2ensite kolibri.conf
2020-01-11 21:29:20 +00:00
when: apache_install and kolibri_enabled
2020-01-11 21:29:20 +00:00
- name: Disable http://box{{ kolibri_url }} via Apache
2019-09-05 05:16:40 +00:00
command: a2dissite kolibri.conf
2020-01-11 21:29:20 +00:00
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
2019-09-05 05:16:40 +00:00
2020-01-11 21:29:20 +00:00
# NGINX
- name: Enable http://box{{ kolibri_url }} via NGINX, by installing {{ nginx_config_dir }}/kolibri-nginx.conf from template
2019-09-05 05:16:40 +00:00
template:
2020-01-11 21:29:20 +00:00
src: kolibri-nginx.conf.j2
dest: "{{ nginx_config_dir }}/kolibri-nginx.conf"
when: nginx_install and kolibri_enabled
2019-09-05 05:16:40 +00:00
2020-01-11 21:29:20 +00:00
- 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
2020-01-11 21:29:20 +00:00
when: nginx_install and not kolibri_enabled
2019-09-05 05:16:40 +00:00
2020-01-11 21:29:20 +00:00
- name: Restart 'nginx' systemd service
2019-09-05 05:16:40 +00:00
systemd:
name: nginx
state: restarted
2020-01-11 21:29:20 +00:00
when: nginx_enabled | bool
2019-09-05 05:16:40 +00:00
- 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 }}"
2019-09-05 05:16:40 +00:00
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 }}"