diff --git a/roles/moodle/tasks/enable.yml b/roles/moodle/tasks/enable.yml index b625ecac6..755721436 100644 --- a/roles/moodle/tasks/enable.yml +++ b/roles/moodle/tasks/enable.yml @@ -1,21 +1,39 @@ -- name: Create symlink 022-moodle.conf from sites-enabled to sites-available, if moodle_enabled (debuntu) - file: - src: /etc/apache2/sites-available/022-moodle.conf - dest: /etc/apache2/sites-enabled/022-moodle.conf - state: link - when: moodle_enabled and is_debuntu +# Apache -- name: Remove symlink 022-moodle.conf, if not moodle_enabled (debuntu) - file: - path: /etc/apache2/sites-enabled/022-moodle.conf - state: absent - when: not moodle_enabled and is_debuntu +- name: Enable http://box/moodle via Apache + command: a2ensite 022-moodle.conf + when: apache_install and moodle_enabled -- name: Restart Apache service ({{ apache_service }}) +- 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 }}" + name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/.yml state: restarted - daemon-reload: yes + 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: diff --git a/roles/wordpress/tasks/enable.yml b/roles/wordpress/tasks/enable.yml index 397a48d61..b9b2cf0aa 100644 --- a/roles/wordpress/tasks/enable.yml +++ b/roles/wordpress/tasks/enable.yml @@ -1,10 +1,10 @@ # Apache -- name: "Enable http://box{{ wp_url }} via Apache" +- name: Enable http://box{{ wp_url }} via Apache command: a2ensite wordpress.conf when: apache_install and wordpress_enabled -- name: "Disable http://box{{ wp_url }} via Apache" +- name: Disable http://box{{ wp_url }} via Apache command: a2dissite wordpress.conf when: apache_install and not wordpress_enabled @@ -16,13 +16,13 @@ # NGINX -- name: "Enable http://box{{ wp_url }} via NGINX, by installing {{ nginx_config_dir }}/wordpress-nginx.conf from template" +- name: Enable http://box{{ wp_url }} via NGINX, by installing {{ nginx_config_dir }}/wordpress-nginx.conf from template template: src: wordpress-nginx.conf.j2 dest: "{{ nginx_config_dir }}/wordpress-nginx.conf" when: nginx_install and wordpress_enabled -- name: "Disable http://box{{ wp_url }} via NGINX, by removing {{ nginx_config_dir }}/wordpress-nginx.conf" +- name: Disable http://box{{ wp_url }} via NGINX, by removing {{ nginx_config_dir }}/wordpress-nginx.conf file: path: "{{ nginx_config_dir }}/wordpress-nginx.conf" state: absent