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

68 lines
1.9 KiB
YAML
Raw Normal View History

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)
# 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
- 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:
path: "{{ nginx_config_dir }}/moodle-nginx.conf"
2019-09-05 05:45:31 +00:00
state: absent
when: nginx_install and not moodle_enabled
2019-09-05 05:45:31 +00:00
- name: Restart 'nginx' systemd service
2019-09-05 05:45:31 +00:00
systemd:
name: nginx
2019-09-05 05:45:31 +00:00
state: restarted
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 }}"
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 }}"