diff --git a/roles/moodle/defaults/main.yml b/roles/moodle/defaults/main.yml index 193c21d64..23be708e0 100644 --- a/roles/moodle/defaults/main.yml +++ b/roles/moodle/defaults/main.yml @@ -10,6 +10,10 @@ moodle_version: 311 moodle_repo_url: https://github.com/moodle/moodle #moodle_repo_url: git://git.moodle.org/moodle.git # 2020-10-16: VERY Slow! + moodle_base: "{{ iiab_base }}/moodle" # /opt/iiab moodle_data: "{{ content_base }}/moodle" # /library -moodle_database_name: moodle + +moodle_db_name: moodle +moodle_db_user: Admin +moodle_db_pass: changeme diff --git a/roles/moodle/tasks/install.yml b/roles/moodle/tasks/install.yml index aa763be59..66dd5cb74 100644 --- a/roles/moodle/tasks/install.yml +++ b/roles/moodle/tasks/install.yml @@ -20,12 +20,13 @@ # 2021-07-02: Let's monitor & learn from these 2 pages year-by-year: # https://docs.moodle.org/19/en/PHP_settings_by_Moodle_version#PHP_Extensions_and_libraries # https://github.com/moodlebox/moodlebox/blob/master/roles/packages/vars/main.yml -- name: Install ghostscript + libsodium23 + 8 PHP packages (run 'php -m' or 'php -i' to verify) +- name: Install ghostscript + libsodium23 + poppler-utils + 8 PHP packages (run 'php -m' or 'php -i' to verify) package: name: #- php-apcu # 2021-07-02: Experiment with fewer dependencies - ghostscript # 2021-07-02: OPTIONAL -- but useful for annotation of PDF's / assignments - libsodium23 # 2021-06-28: Likewise installed in nginx/tasks/install.yml via php{{ php_version }}-fpm AND httpd/tasks/install.yml via libapache2-mod-php{{ php_version }} AND wordpress/tasks/install.yml -- it can ALSO be auto-installed by phpX.Y-cgi OR phpX.Y-cli as confirmed by 'apt rdepends libsodium23' -- Recommended by Moodle 3.11+ at https://docs.moodle.org/311/en/Environment_-_PHP_extension_sodium -- whereas https://www.php.net/manual/en/sodium.installation.php says it's always bundled with PHP 7.2+ -- VERIFY USING 'php -i | grep sodium' AND 'apt list "*sodium*"' + - poppler-utils # 2021-07-20: Convert PDF to PNG, with pathtopdftoppm set below (#2854) #- php{{ php_version }}-common # 2021-06-27: Auto-installed as an apt dependency. REGARDLESS: php{{ php_version }}-common superset php{{ php_version }}-cli is auto-installed by php{{ php_version }}-fpm in nginx/tasks/install.yml #- php{{ php_version }}-cli # 2021-06-27: Compare to php{{ php_version }}-common just above! 2020-06-15: In the past this included (below) mbstring? However this is not true on Ubuntu Server 20.04 LTS. - php{{ php_version }}-curl # 2021-06-27: Likewise installed in nextcloud/tasks/install.yml, pbx/tasks/freepbx_dependencies.yml, wordpress/tasks/install.yml @@ -72,21 +73,21 @@ name: postgresql-iiab state: started -- name: Create PostgreSQL db user Admin/changeme +- name: Create PostgreSQL db user {{ moodle_db_user }}/{{ moodle_db_pass }} postgresql_user: - name: Admin - password: changeme - encrypted: yes # Required by PostgreSQL 10+ e.g. Ubuntu 18.04's PostgreSQL 10.3+, see https://github.com/iiab/iiab/issues/759 + name: "{{ moodle_db_user }}" # Admin + password: "{{ moodle_db_pass }}" # changeme + encrypted: yes # Required by PostgreSQL 10+ e.g. Ubuntu 18.04's PostgreSQL 10.3+, see https://github.com/iiab/iiab/issues/759 role_attr_flags: NOSUPERUSER,NOCREATEROLE,NOCREATEDB state: present become: yes become_user: postgres -- name: 'Create database: {{ moodle_database_name }}' +- name: 'Create database: {{ moodle_db_name }}' postgresql_db: - name: "{{ moodle_database_name }}" + name: "{{ moodle_db_name }}" encoding: utf8 - owner: Admin + owner: "{{ moodle_db_user }}" template: template1 state: present become: yes @@ -140,6 +141,9 @@ - include_tasks: mathjax.yml +- name: Run 'php {{ moodle_base }}/admin/cli/cfg.php --name=pathtopdftoppm --set=/usr/bin/pdftoppm' for converting PDF files to PNG (faster than Ghostscript, particularly for large files) -- works with apt package 'poppler-utils' installed above (#2854) + command: php "{{ moodle_base }}/admin/cli/cfg.php" --name=pathtopdftoppm --set=/usr/bin/pdftoppm + # RECORD Moodle AS INSTALLED diff --git a/roles/moodle/templates/moodle_installer b/roles/moodle/templates/moodle_installer index be6b18bf6..2234af0a2 100755 --- a/roles/moodle/templates/moodle_installer +++ b/roles/moodle/templates/moodle_installer @@ -10,7 +10,7 @@ sudo -u {{ apache_user }} \ --wwwroot=http://{{ iiab_hostname }}.{{ iiab_domain }}/moodle \ --dataroot={{ moodle_data }} \ --dbtype=pgsql \ - --dbname={{ moodle_database_name }} \ + --dbname={{ moodle_db_name }} \ --dbuser=Admin --dbpass=changeme \ --fullname=Your_School \ --shortname=School \