- 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 - name: Restart Apache systemd service ({{ apache_service }}) systemd: name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/.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 }}"