mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Merge branch 'master' into allow-large-uploads
This commit is contained in:
commit
dcfd65fee4
388 changed files with 11174 additions and 4170 deletions
|
@ -7,11 +7,16 @@
|
|||
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
|
||||
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
|
||||
|
||||
moodle_version: 311
|
||||
|
||||
# 2023-04-25: Currently testing Moodle's master branch is mandatory if your
|
||||
# OS PHP >= 8.3, see moodle/tasks/install.yml for detail! OR, *IF* your
|
||||
# OS PHP < 8.3, then {{ moodle_version }} will be attempted:
|
||||
moodle_version: MOODLE_403_STABLE # Moodle 4.3
|
||||
#moodle_version: master # e.g. to try Moodle's "weekly" 4.2dev pre-release *EVEN IF* OS PHP < 8.2
|
||||
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_base: "{{ iiab_base }}/moodle" # /opt/iiab
|
||||
moodle_data: "{{ content_base }}/moodle" # /library
|
||||
|
||||
moodle_db_name: moodle
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
- name: "Set 'postgresql_install: True' and 'postgresql_enabled: True'"
|
||||
set_fact:
|
||||
postgresql_install: True
|
||||
postgresql_enabled: True # Revert just below if...
|
||||
|
||||
- name: "Set 'postgresql_enabled: False' if not moodle_enabled"
|
||||
set_fact:
|
||||
postgresql_enabled: False
|
||||
when: not moodle_enabled # and not (pathagar_enabled is defined and pathagar_enabled)
|
||||
|
||||
- name: POSTGRESQL - run 'postgresql' role (Enable&Start or Disable&Stop PostgreSQL)
|
||||
include_role:
|
||||
name: postgresql
|
||||
|
||||
|
||||
- name: Enable http://box/moodle via NGINX, by installing {{ nginx_conf_dir }}/moodle-nginx.conf from template
|
||||
template:
|
||||
src: moodle-nginx.conf.j2
|
|
@ -6,6 +6,20 @@
|
|||
# 2021-06-28: This ALSO now happens in /etc/php/{{ php_version }}/cli/php.ini
|
||||
# (as required by Moodle's CLI installer, DESPITE it using fpm/php.ini later!)
|
||||
|
||||
# 2023-12-17: Upgrade instructions via CLI
|
||||
# https://docs.moodle.org/en/Administration_via_command_line
|
||||
#
|
||||
# EXAMPLE:
|
||||
# cd /opt/iiab/moodle
|
||||
# sudo -u www-data /usr/bin/php admin/cli/maintenance.php --enable
|
||||
# cd /opt/iiab
|
||||
# mv moodle moodle.bkp
|
||||
# git clone https://github.com/moodle/moodle -b MOODLE_403_STABLE --depth 1 # As a regular 'git pull' will likely fail, due to original clone's '--depth 1' -- but no worries: total clone download is just ~100 MB, which expands to ~400 MB
|
||||
# cp moodle.bkp/config.php moodle/
|
||||
# cd moodle
|
||||
# sudo -u www-data /usr/bin/php admin/cli/upgrade.php # Or later log in to Moodle, to complete the upgrade (i.e. click "Continue" 4-5 times)
|
||||
# sudo -u www-data /usr/bin/php admin/cli/maintenance.php --disable
|
||||
|
||||
|
||||
- name: "Set 'postgresql_install: True' and 'postgresql_enabled: True'"
|
||||
set_fact:
|
||||
|
@ -17,6 +31,11 @@
|
|||
name: postgresql
|
||||
|
||||
|
||||
- name: Record (initial) disk space used
|
||||
shell: df -B1 --output=used / | tail -1
|
||||
register: df1
|
||||
|
||||
|
||||
# 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
|
||||
|
@ -30,6 +49,7 @@
|
|||
#- 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
|
||||
#- php{{ php_version }}-exif # 2022-11-27: Recommended by Moodle 4.1, possibly required by Moodle 4.2 (for image metadata, rotation, etc?) apt package(s) NOT REQUIRED as it's somehow already installed with PHP's core, as confirmed by 'php -m' & 'php -i' on Ubuntu 22.04 and RasPiOS.
|
||||
- php{{ php_version }}-gd # 2021-06-27: Likewise installed in nextcloud/tasks/install.yml, pbx/tasks/freepbx_dependencies.yml
|
||||
- php{{ php_version }}-intl # 2020-12-03: Required by Moodle 3.10+ -- Likewise installed in mediawiki/tasks/install.yml, nextcloud/tasks/install.yml, wordpress/tasks/install.yml
|
||||
- php{{ php_version }}-mbstring # 2020-06-15: Required by Moodle 3.9+ -- Likewise installed in mediawiki/tasks/install.yml, nextcloud/tasks/install.yml, pbx/tasks/freepbx_dependencies.yml, wordpress/tasks/install.yml
|
||||
|
@ -43,14 +63,54 @@
|
|||
- php{{ php_version }}-zip # 2021-06-27: Likewise installed in nextcloud/tasks/install.yml, pbx/tasks/freepbx_dependencies.yml, wordpress/tasks/install.yml
|
||||
state: present
|
||||
|
||||
- name: Download (clone) {{ moodle_repo_url }} to {{ moodle_base }} (~356 MB initially, ~376 MB later)
|
||||
- name: "Run roles/www_options/tasks/php-settings.yml with 'nginx_high_php_limits: True' by default"
|
||||
include_tasks: roles/www_options/tasks/php-settings.yml
|
||||
when: php_settings_done is undefined
|
||||
|
||||
|
||||
- name: Does /opt/iiab/moodle exist?
|
||||
stat:
|
||||
path: /opt/iiab/moodle
|
||||
register: opt_iiab_moodle
|
||||
|
||||
# 2023-04-30: Allows re-running (e.g. 'sudo iiab') if git clone was already
|
||||
# begun, avoiding this error: (arises from 'www-data' ownership)
|
||||
# "Failed to set a new url https://github.com/moodle/moodle for origin:
|
||||
# fatal: detected dubious ownership in repository at '/opt/iiab/moodle'
|
||||
# To add an exception for this directory, call:
|
||||
# git config --global --add safe.directory /opt/iiab/moodle"
|
||||
|
||||
- name: If /opt/iiab/moodle exists, move it to /tmp/opt-iiab-moodle.old (TO BE DELETED ON NEXT BOOT) -- allows re-running if git clone (below) was already begun
|
||||
shell: rm -rf /tmp/opt-iiab-moodle.old && mv /opt/iiab/moodle /tmp/opt-iiab-moodle.old
|
||||
when: opt_iiab_moodle.stat.exists
|
||||
|
||||
|
||||
# WARNING: Since March 2023, 32-bit RasPiOS can act as 64-bit on RPi 4 and
|
||||
# RPi 400 (unlike RPi 3!) SEE: https://github.com/iiab/iiab/pull/3516
|
||||
- name: Run command 'dpkg --print-architecture' to identify OS architecture (CPU arch as revealed by ansible_architecture ~= ansible_machine is NO LONGER enough!)
|
||||
command: dpkg --print-architecture
|
||||
register: dpkg_arch
|
||||
|
||||
- name: "2023-04-30: MOODLE 4.2+ REQUIRES PHP 8 AND *FULL* 64-BIT OPERATION -- SO WE REVERT TO TRYING THE OLDER MOODLE 4.1 LTS WHEN NECESSARY -- NOTE PHP 7.x END-OF-LIFE WAS NOVEMBER 2022"
|
||||
set_fact:
|
||||
moodle_version: MOODLE_401_STABLE # i.e. Moodle 4.1 LTS
|
||||
when: php_version is version('8.0', '<') or not dpkg_arch.stdout is search("64")
|
||||
|
||||
- name: Download (clone) {{ moodle_repo_url }} branch '{{ moodle_version }}' to {{ moodle_base }} (~403 MB initially, ~431 MB later) if OS PHP {{ php_version }} < 8.3
|
||||
git:
|
||||
repo: "{{ moodle_repo_url }}" # https://github.com/moodle/moodle
|
||||
dest: "{{ moodle_base }}" # /opt/iiab/moodle
|
||||
depth: 1
|
||||
version: "MOODLE_{{ moodle_version }}_STABLE"
|
||||
#version: master # TEMPORARY DURING MAY 2018 TESTING, installed 3.5beta+ = https://download.moodle.org/releases/development/
|
||||
#ignore_errors: yes
|
||||
version: "{{ moodle_version }}" # e.g. MOODLE_403_STABLE (Moodle 4.3)
|
||||
when: php_version is version('8.3', '<')
|
||||
|
||||
- name: "MOODLE PRE-RELEASE TESTING: Download (clone) {{ moodle_repo_url }} branch 'master' to {{ moodle_base }} (~403 MB initially, ~431 MB later) if OS PHP {{ php_version }} >= 8.3"
|
||||
git:
|
||||
repo: "{{ moodle_repo_url }}"
|
||||
dest: "{{ moodle_base }}"
|
||||
depth: 1
|
||||
version: master # For "weekly" Moodle pre-releases: https://download.moodle.org/releases/development/ (e.g. 3.5beta+ in May 2018, 4.1dev in Sept 2022, 4.2dev in Dec 2022, 4.3dev in May 2023, 4.4dev in Oct 2023)
|
||||
when: php_version is version('8.3', '>=')
|
||||
|
||||
- name: chown -R {{ apache_user }}:{{ apache_user }} {{ moodle_base }} (by default dirs 755 & files 644)
|
||||
file:
|
||||
|
@ -128,7 +188,7 @@
|
|||
# 2021-11-19: Resolves Moodle error https://github.com/iiab/iiab/issues/3024
|
||||
- name: Set cron job to run /opt/iiab/moodle/admin/cli/cron.php every minute (* * * * *) in /var/spool/cron/crontabs/www-data -- per https://docs.moodle.org/310/en/Cron
|
||||
cron:
|
||||
name: https://docs.moodle.org/310/en/Cron
|
||||
name: https://docs.moodle.org/en/Cron
|
||||
user: www-data
|
||||
job: "/usr/bin/php /opt/iiab/moodle/admin/cli/cron.php >/dev/null"
|
||||
|
||||
|
@ -154,6 +214,17 @@
|
|||
|
||||
# RECORD Moodle AS INSTALLED
|
||||
|
||||
- name: Record (final) disk space used
|
||||
shell: df -B1 --output=used / | tail -1
|
||||
register: df2
|
||||
|
||||
- name: Add 'moodle_disk_usage = {{ df2.stdout|int - df1.stdout|int }}' to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
|
||||
section: moodle
|
||||
option: moodle_disk_usage
|
||||
value: "{{ df2.stdout|int - df1.stdout|int }}"
|
||||
|
||||
- name: "Set 'moodle_installed: True'"
|
||||
set_fact:
|
||||
moodle_installed: True
|
||||
|
|
|
@ -19,44 +19,35 @@
|
|||
quiet: yes
|
||||
|
||||
|
||||
- name: Install Moodle if 'moodle_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
|
||||
include_tasks: install.yml
|
||||
when: moodle_installed is undefined
|
||||
- block:
|
||||
|
||||
- name: Install Moodle if 'moodle_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
|
||||
include_tasks: install.yml
|
||||
when: moodle_installed is undefined
|
||||
|
||||
- name: "Set 'postgresql_install: True' and 'postgresql_enabled: True'"
|
||||
set_fact:
|
||||
postgresql_install: True
|
||||
postgresql_enabled: True # Revert just below if...
|
||||
- include_tasks: enable-or-disable.yml
|
||||
|
||||
- name: "Set 'postgresql_enabled: False' if not moodle_enabled"
|
||||
set_fact:
|
||||
postgresql_enabled: False
|
||||
when: not moodle_enabled # and not (pathagar_enabled is defined and pathagar_enabled)
|
||||
- name: Add 'moodle' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
|
||||
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_install
|
||||
value: "{{ moodle_install }}"
|
||||
- option: moodle_enabled
|
||||
value: "{{ moodle_enabled }}"
|
||||
- option: moodle_base
|
||||
value: "{{ moodle_base }}"
|
||||
|
||||
- name: POSTGRESQL - run 'postgresql' role (Enable&Start or Disable&Stop PostgreSQL)
|
||||
include_role:
|
||||
name: postgresql
|
||||
rescue:
|
||||
|
||||
|
||||
- name: Enable/Disable/Restart NGINX
|
||||
include_tasks: nginx.yml
|
||||
|
||||
|
||||
- name: Add 'moodle' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
|
||||
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_install
|
||||
value: "{{ moodle_install }}"
|
||||
- option: moodle_enabled
|
||||
value: "{{ moodle_enabled }}"
|
||||
- option: moodle_base
|
||||
value: "{{ moodle_base }}"
|
||||
- name: 'SEE ERROR ABOVE (skip_role_on_error: {{ skip_role_on_error }})'
|
||||
fail:
|
||||
msg: ""
|
||||
when: not skip_role_on_error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue