diff --git a/roles/moodle/defaults/main.yml b/roles/moodle/defaults/main.yml index 2bb7fe704..ab16dea1b 100644 --- a/roles/moodle/defaults/main.yml +++ b/roles/moodle/defaults/main.yml @@ -11,6 +11,5 @@ moodle_version: 310 moodle_repo_url: https://github.com/moodle/moodle.git #moodle_repo_url: git://git.moodle.org/moodle.git # 2020-10-16: VERY Slow! moodle_base: "{{ iiab_base }}/moodle" # /opt/iiab -#moodle_user: moodle -moodle_data: "{{ content_base }}/moodle" # /library/moodle +moodle_data: "{{ content_base }}/moodle" # /library moodle_database_name: moodle diff --git a/roles/moodle/tasks/apache.yml b/roles/moodle/tasks/apache.yml index b0a59d6df..b990f25a8 100644 --- a/roles/moodle/tasks/apache.yml +++ b/roles/moodle/tasks/apache.yml @@ -1,8 +1,8 @@ -- name: Enable http://box/moodle via Apache +- name: 'Enable http://box/moodle via Apache: create link /etc/apache2/sites-enabled/022-moodle.conf' command: a2ensite 022-moodle.conf when: moodle_enabled -- name: Disable http://box/moodle via Apache +- name: 'Disable http://box/moodle via Apache: remove link /etc/apache2/sites-enabled/022-moodle.conf' command: a2dissite 022-moodle.conf when: not moodle_enabled diff --git a/roles/moodle/tasks/install.yml b/roles/moodle/tasks/install.yml index 2f9495179..f15289ce1 100644 --- a/roles/moodle/tasks/install.yml +++ b/roles/moodle/tasks/install.yml @@ -18,14 +18,6 @@ name: postgresql -# - name: "Install packages: python-psycopg2, php-pgsql (OS's other than debuntu)" -# package: -# name: -# - python-psycopg2 -# - php-pgsql -# state: present -# when: not is_debuntu - - name: Install 8 php packages (debuntu) package: name: @@ -40,22 +32,12 @@ state: present when: is_debuntu -# - name: "Install package: php{{ php_version }}-zip (Ubuntu or Debian 9+)" -# package: -# name: "php{{ php_version }}-zip" -# when: is_ubuntu or (is_debian and not is_debian_8) - -# - name: "Install package: php-pclzip (debian-8)" -# package: -# name: php-pclzip -# when: is_debian_8 - - name: Does {{ moodle_base }}/config-dist.php exist? (indicating Moodle is/was installed) stat: - path: "{{ moodle_base }}/config-dist.php" + path: "{{ moodle_base }}/config-dist.php" # /opt/iiab/moodle register: moodle -- name: Clone (i.e. use git to download) {{ moodle_repo_url }} to {{ moodle_base }} +- name: Clone (i.e. use git to download) {{ moodle_repo_url }} to {{ moodle_base }} (~300 MB) git: repo: "{{ moodle_repo_url }}" dest: "{{ moodle_base }}" @@ -70,37 +52,36 @@ file: state: directory path: "{{ moodle_base }}" - owner: "{{ apache_user }}" + owner: "{{ apache_user }}" # www-data recurse: yes - name: Create dir {{ content_base }}/dbdata/moodle owned by {{ apache_user }} file: state: directory - path: "{{ content_base }}/dbdata/moodle" + path: "{{ content_base }}/dbdata/moodle" # /library owner: "{{ apache_user }}" - # mode: '0755' -- name: Create dir {{ moodle_data }} ({{ apache_user }}:{{ apache_user }}, '0770') # /library/moodle +- name: Create dir {{ moodle_data }} ({{ apache_user }}:{{ apache_user }}, '0770') file: state: directory - path: "{{ moodle_data }}" + path: "{{ moodle_data }}" # /library/moodle owner: "{{ apache_user }}" group: "{{ apache_user }}" - mode: '0770' + #mode: '0770' # Regardless, permissions end up as: drwxrwsrwx - name: Remove stock /etc/{{ apache_conf_dir }}/moodle.conf file: - path: "/etc/{{ apache_conf_dir }}/moodle.conf" + path: "/etc/{{ apache_conf_dir }}/moodle.conf" # apache2/sites-available state: absent +# 2021-02-01: Not nec if we can hopefully migrate from Apache to NGINX soon! - name: Install /etc/{{ apache_conf_dir }}/022-moodle.conf from template template: src: 022-moodle.j2 dest: "/etc/{{ apache_conf_dir }}/022-moodle.conf" - # owner: root - # group: root - # mode: '0644' +# roles/postgresql/templates/postgresql-iiab.service WAS INSTALLED HERE: +# /etc/systemd/system/postgresql-iiab.service - name: Start 'postgresql-iiab' systemd service, to configure Moodle's DB systemd: name: postgresql-iiab @@ -136,8 +117,7 @@ systemd: name: postgresql-iiab state: restarted - #enabled: yes - #when: moodle_enabled + #enabled: yes # Service ends up enabled regardless - name: (Re)Start '{{ apache_service }}' systemd service systemd: @@ -153,11 +133,12 @@ shell: "{{ moodle_base }}/moodle_installer" when: config.stat.exists is defined and not config.stat.exists -- name: Make {{ moodle_base }}/config.php readable, with permission '0644' - #command: chown -R {{ apache_user }} {{ moodle_base }} - file: - path: "{{ moodle_base }}/config.php" # /opt/iiab/moodle - mode: '0644' +# 2021-02-01: Let's stick with Moodle's default (640) +#- name: Make {{ moodle_base }}/config.php readable, with permission '0644' +# #command: chown -R {{ apache_user }} {{ moodle_base }} +# file: +# path: "{{ moodle_base }}/config.php" # /opt/iiab/moodle +# mode: '0644' # RECORD Moodle AS INSTALLED diff --git a/roles/moodle/tasks/main.yml b/roles/moodle/tasks/main.yml index 3189b590c..701dc3210 100644 --- a/roles/moodle/tasks/main.yml +++ b/roles/moodle/tasks/main.yml @@ -24,27 +24,10 @@ when: moodle_installed is undefined -# - name: Enable 'postgresql-iiab' systemd service, if moodle_enabled -# systemd: -# name: postgresql-iiab -# deamon_reload: yes -# 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 and not (pathagar_enabled is defined and pathagar_enabled)' -# systemd: -# name: postgresql-iiab -# state: stopped -# enabled: no -# when: not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled) - -- name: "Set 'postgresql_install: True' and 'postgresql_enabled: True' if moodle_enabled" +- name: "Set 'postgresql_install: True' and 'postgresql_enabled: True'" set_fact: postgresql_install: True - postgresql_enabled: True - when: moodle_enabled + postgresql_enabled: True # Revert just below if... - name: "Set 'postgresql_enabled: False' if 'not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)'" set_fact: @@ -56,14 +39,11 @@ name: postgresql -#- name: Enable/Disable/Restart Apache if primary - name: SHIM FOR NOW SO ALWAYS DO THE...Enable/Disable/Restart Apache include_tasks: apache.yml - #when: not nginx_enabled -- name: Enable/Disable/Restart NGINX if primary +- name: Enable/Disable/Restart NGINX include_tasks: nginx.yml - when: nginx_enabled - name: Add 'moodle' variable values to {{ iiab_ini_file }} @@ -77,7 +57,7 @@ value: Moodle - option: description value: '"Access the Moodle learning management system."' - - option: "moodle_base" + - option: moodle_base value: "{{ moodle_base }}" - option: moodle_enabled value: "{{ moodle_enabled }}"