An example ansible playbook to quickly create a local dev Moodle server
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Easy Local Moodle Dev Server

This is an example of how to get a local dev server up and running without any interaction or configuration.

Note that the database dump and development private key files were removed from this example, so you will need to use your own web application files!

How do I get set up?

End result

  • Vagrant will:

    • Download and setup up the Ubuntu VM, and run the ansible playlist against it
    • Forward localhost port 8080 to the VM port 80
    • Create a link between the VM web application files and the host "../html" directory to allow for local file editing
  • The Ansible playlist will:

    • Install and configure Apache to serve the PHP application
    • Install and configure MariaDB (MySQL replacement), and import a database dump (database dump not included)
    • Clone the GIT repo for the web application into the webserver directory and set permissions (repo private key not included)
    • Create a moodledata directory and set permissions

Other Tips

  • When working on your local machine, you will want to edit your hosts file and add the following line. This will allow third-party tools (Facebook login, other embeds) that restrict based on domain name to load properly.


  • I created this to show how easy it was to use Vagrant and Ansible to provision and manage a local moodle development webserver. No need to struggle with a Windows stack with a complex GUI configuration that requires significant set up time each time you shift computers.
  • If you have any questions are want more info on how to do this, please ask! I took this on as a small learning project and will be happy to tackle any questions.