Ansible Role moodle
This role installs Moodle, an open source Learning Management System (LMS) designed to provide educators with tools for creating and managing online courses and learning activities.
This role supports the following Moodle versions:
v4.1 LTS
Setting the version manually:
ansible-playbook --inventory=myansinv linuxfabrik.lfops.setup_moodle --tags=moodle --extra-vars="moodle__github_version=v4.1.12"
Mandatory Requirements
Attention: Moodle v4.1 has very specific version requirements regarding PHP and Redis. See https://moodledev.io/general/development/policies/php.
Install a web server (for example Apache httpd), and configure a virtual host for Moodle. This can be done using the linuxfabrik.lfops.apache_httpd role.
Install PHP v8.1. This can be done using the linuxfabrik.lfops.repo_remi and linuxfabrik.lfops.php role.
Install Redis v7.2. This can be done using the linuxfabrik.lfops.repo_remi and linuxfabrik.lfops.redis role.
If you use the „Setup Moodle“ Playbook, this is automatically done for you.
Mandatory Role Variables
Variable |
Description |
---|---|
|
Dictionary. The admin account to create. Subkeys:
|
|
Dictionary. The user account for accessing the Moodle SQL database. Currently, only MySQL/MariaDB is supported. Subkeys:
|
|
String. The public facing Moodle URL, including |
Example:
# mandatory
moodle__admin:
username: 'moodle-admin'
password: 'linuxfabrik'
email: 'learning@example.com'
moodle__database_login:
username: 'moodle'
password: 'linuxfabrik'
moodle__url: 'https://learning.example.com'
Optional Role Variables
Variable |
Description |
Default Value |
---|---|---|
|
Behind a Reverse Proxy (assuming it terminates TLS) or not? |
|
|
String. Location of the moodle data folder, must not be web accessible. |
|
|
String. Database host. |
|
|
String. The Host-part of the SQL database user. |
|
|
String. Database name. |
|
|
Number. Database port. |
|
|
String. Path to database socket file. |
|
|
String. Table prefix for all database tables. |
|
|
String. Database socket path. |
|
|
String. Run interval of Moodle |
|
|
String. This name appears at the top of every page above the navigation bar. |
|
|
String. The short name appears at the beginning of the navigation bar as a link back to your site front page. |
|
|
String. This summary can be displayed on the left or right of the front page using the course/site summary block. The summary is also used as the HTML metadata description in some themes, for the front page of the site. This is not generally seen by users, but can be useful for search engines that index the page. |
|
|
String. Admin site preset to be applied during the installation process. |
|
|
String. Email address for support and help. |
|
|
Boolean. Enables/disables Systemd-Timer for running |
|
|
String. The upgrade key to be set in the |
|
Example:
# optional
moodle__behind_reverse_proxy: true
moodle__data_dir: '/data'
moodle__database_host: 'localhost'
moodle__database_login_host: 'localhost'
moodle__database_name: 'moodle'
moodle__database_port: 3306
moodle__database_socket: '/var/lib/mysql/mysql.sock'
moodle__database_table_prefix: 'mdl_'
moodle__install_dir: '/var/www/html/moodle'
moodle__on_calendar_cron: 'minutely'
moodle__site_fullname: 'Moodle powered by Linuxfabrik'
moodle__site_shortname: 'Moodle'
moodle__site_summary: 'My Site Summary'
moodle__sitepreset: ''
moodle__supportemail: 'support@example.com'
moodle__timer_cron_enabled: true
moodle__upgradekey: ''
Optional Role Variables - Moosh
This role supports the administration of Moodle using Moosh. This is done by defining a list of user-defined commands and executing them using the moodle:moosh_run
tag. Commands can be defined just like on the command line, so you are free to do whatever you want with Moosh.
Variable |
Description |
Default Value |
---|---|---|
|
List of strings. List of commands that Moosh should execute. |
|
|
String. Moosh download URL on moodle.org. |
|
Example:
# optional
moodle__moosh_commands:
- 'user-create --firstname=Linus --lastname=Löffel --city=Zurich --country=Switzerland linus'
- 'user-list --sort'
moodle__moosh_download_url: 'https://moodle.org/plugins/download.php/31885/moosh_moodle44_2024050100.zip'