2020-01-05 03:38:54 +00:00
|
|
|
- name: Enable postgresql-iiab service when moodle_enabled
|
|
|
|
systemd:
|
|
|
|
name: postgresql-iiab
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
when: moodle_enabled
|
|
|
|
|
|
|
|
# if the only service using the backend db disable if not running
|
|
|
|
- name: Disable postgresql-iiab service when not moodle_enabled
|
|
|
|
systemd:
|
|
|
|
name: postgresql-iiab
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
when: not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)
|
|
|
|
|
2020-01-13 02:39:37 +00:00
|
|
|
# Apache
|
|
|
|
|
|
|
|
- name: Enable http://box/moodle via Apache
|
|
|
|
command: a2ensite 022-moodle.conf
|
|
|
|
when: apache_install and moodle_enabled
|
|
|
|
|
|
|
|
- name: Disable http://box/moodle via Apache
|
|
|
|
command: a2dissite 022-moodle.conf
|
|
|
|
when: apache_install and not moodle_enabled
|
2019-09-05 05:45:31 +00:00
|
|
|
|
2020-01-13 02:39:37 +00:00
|
|
|
- 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/moodle via NGINX, by installing {{ nginx_config_dir }}/moodle-nginx.conf from template
|
|
|
|
template:
|
|
|
|
src: moodle-nginx.conf.j2
|
|
|
|
dest: "{{ nginx_config_dir }}/moodle-nginx.conf"
|
|
|
|
when: nginx_install and moodle_enabled
|
|
|
|
|
|
|
|
- name: Disable http://box/moodle via NGINX, by removing {{ nginx_config_dir }}/moodle-nginx.conf
|
2019-09-05 05:45:31 +00:00
|
|
|
file:
|
2020-01-13 02:39:37 +00:00
|
|
|
path: "{{ nginx_config_dir }}/moodle-nginx.conf"
|
2019-09-05 05:45:31 +00:00
|
|
|
state: absent
|
2020-01-13 02:39:37 +00:00
|
|
|
when: nginx_install and not moodle_enabled
|
2019-09-05 05:45:31 +00:00
|
|
|
|
2020-01-13 02:39:37 +00:00
|
|
|
- name: Restart 'nginx' systemd service
|
2019-09-05 05:45:31 +00:00
|
|
|
systemd:
|
2020-01-13 02:39:37 +00:00
|
|
|
name: nginx
|
2019-09-05 05:45:31 +00:00
|
|
|
state: restarted
|
2020-01-13 02:39:37 +00:00
|
|
|
when: nginx_enabled | bool
|
|
|
|
|
2019-09-05 05:45:31 +00:00
|
|
|
|
|
|
|
- name: Add 'moodle' variable values to {{ iiab_ini_file }}
|
|
|
|
ini_file:
|
|
|
|
path: "{{ iiab_ini_file }}"
|
|
|
|
section: moodle
|
|
|
|
option: "{{ item.option }}"
|
2020-01-12 02:41:37 +00:00
|
|
|
value: "{{ item.value | string }}"
|
2019-09-05 05:45:31 +00:00
|
|
|
with_items:
|
|
|
|
- option: name
|
|
|
|
value: Moodle
|
|
|
|
- option: description
|
|
|
|
value: '"Access the Moodle learning management system."'
|
|
|
|
- option: "moodle_base"
|
|
|
|
value: "{{ moodle_base }}"
|
|
|
|
- option: moodle_enabled
|
|
|
|
value: "{{ moodle_enabled }}"
|