mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
67 lines
2 KiB
YAML
67 lines
2 KiB
YAML
- name: Enable 'postgresql-iiab' systemd service, if 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' systemd service, if 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
|
|
|
|
- name: Restart '{{ apache_service }}' systemd 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
|
|
file:
|
|
path: "{{ nginx_config_dir }}/moodle-nginx.conf"
|
|
state: absent
|
|
when: nginx_install and not moodle_enabled
|
|
|
|
- name: Restart 'nginx' systemd service
|
|
systemd:
|
|
name: nginx
|
|
state: restarted
|
|
when: nginx_enabled | bool
|
|
|
|
|
|
- name: Add 'moodle' variable values to {{ iiab_ini_file }}
|
|
ini_file:
|
|
path: "{{ iiab_ini_file }}"
|
|
section: moodle
|
|
option: "{{ item.option }}"
|
|
value: "{{ item.value | string }}"
|
|
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 }}"
|