damianlewis.moodle
Ansible Role: Moodle
This role installs and sets up Moodle.
Requirements
Before using this role, ensure you meet the minimum requirements for Moodle.
Role Variables
Here are the variables you can use. Check defaults/main.yml
for their default values.
moodle_root_path: /var/www/moodle
This is where Moodle will be installed.
moodle_dataroot_path: /var/www/moodledata
This is the location for the 'moodledata' folder, which will be created if it doesn't already exist.
moodle_version: '3.3'
The latest version of Moodle will be installed by default. You can choose a different version by changing the moodle_version
variable.
moodle_root_user: root
moodle_root_group: root
moodle_root_permissions: '0755'
The default owner and group for the 'moodle' root folder is root
. You can change these using moodle_root_user
and moodle_root_group
. The default permissions are 0755
, but you can modify these with the moodle_root_permissions
variable.
moodle_dataroot_user: www-data
moodle_dataroot_group: www-data
moodle_dataroot_permissions: '0777'
The default owner and group for the 'moodledata' folder is www-data
. You can change them with moodle_dataroot_user
and moodle_dataroot_group
. The default permissions are 0777
, and you can adjust these with the moodle_dataroot_permissions
variable.
moodle_fullname: My Moodle website
moodle_shortname: mymoodle
Set moodle_fullname
to the full name of your site and moodle_shortname
to the shorter name.
moodle_wwwroot: https://example.com
Set the moodle_wwwroot
variable to your Moodle site’s web address.
moodle_database_type: pgsql
Moodle uses MySQL by default for its database. To use another type, change the moodle_database_type
variable. Supported types include pgsql
, mariadb
, mysqli
, mssql
, sqlsrv
, and oci
.
moodle_database_name: example_database
moodle_database_user: example_user
moodle_database_password: secret
Configure the database that Moodle will use with these settings.
moodle_database_host: '192.168.2.18'
moodle_database_port: '33060'
moodle_database_prefix: app_
The default host is localhost
. Use moodle_database_host
to change it. The default port for MySQL is 3306
, but you can set a different port using moodle_database_port
. The prefix for all of Moodle's database tables is mdl_
. To change this, update the moodle_database_prefix
variable.
moodle_admin_username: admin
moodle_admin_password: P@ssw0rd
moodle_admin_email: [email protected]
Set up the default admin account with these details.
moodle_enable_debug: true
Debug mode is off by default. To turn it on, set moodle_enable_debug
to true
.
Dependencies
There are none.
Example Playbook
- hosts: server
become: yes
tasks:
- import_role:
name: damianlewis.moodle
ansible-galaxy install damianlewis.moodle