{"id":18445837,"url":"https://github.com/voronenko/devops-moodle-box","last_synced_at":"2025-04-15T01:16:47.755Z","repository":{"id":145345169,"uuid":"51710648","full_name":"Voronenko/devops-moodle-box","owner":"Voronenko","description":"bootstrap repository for moodle installation with ansible","archived":false,"fork":false,"pushed_at":"2016-02-15T15:18:59.000Z","size":416,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T01:16:36.570Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Voronenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-14T19:55:00.000Z","updated_at":"2016-02-14T20:02:14.000Z","dependencies_parsed_at":"2023-05-02T10:44:46.554Z","dependency_job_id":null,"html_url":"https://github.com/Voronenko/devops-moodle-box","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fdevops-moodle-box","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fdevops-moodle-box/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fdevops-moodle-box/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fdevops-moodle-box/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Voronenko","download_url":"https://codeload.github.com/Voronenko/devops-moodle-box/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986316,"owners_count":21194025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T07:07:35.286Z","updated_at":"2025-04-15T01:16:47.736Z","avatar_url":"https://github.com/Voronenko.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# Moodle installation on Ubuntu 14.04 in BlueMix cloud environment with ansible\n\n## Introduction\n\nMoodle is an open source Course Management Platform that allows you\nto create online learning sites. The name stands for\nModular Object-Oriented Dynamic Learning Environment\nand it has number of features allowing for an efficient online\nlearning experience that can scale from a small number of students to\nhundreds.\n\nFor example, you could introduce assignment submission, quizzes, FAQ, scoring,\ninstant messages, discussion boards, etc. But\nAs it is a modular software, it can be extended with plugins to add extra functionality.\n\n\nMoodle typically runs on LAMP (Linux, Apache, MySQL and PHP) but can\nalso be used with other webservers, like nginx and even on Windows under IIS.\n\n\nModularity is both pros and cons - usually, if you are the teacher, you have your own preferred set of themes and plugins.\nThis makes initial Moodle installation a real pain for non-technical users.\n\nFortunately, deployment automation tool called ansible will save you time on installation\n\n# Background\n\n\n## Challenges to address\n  * Describe desired Moodle components\n  * Optionally install MySQL (you might use external database)\n  * Optionally install LAMP (perhaps you upgrade Moodle itself).\n  * Optionally install Moodle's plugin and themes of your choice\n  * Install Moodle core components\n\nLet's go step by step.\n\n\n\n## Describing desired Moodle components\n\nAccording to official installation tutorial found on https://docs.moodle.org/30/en/Step-by-step_Installation_Guide_for_Ubuntu\nLet's list both package dependencies and needed php extensions.\n\u003cpre\u003e\n  pkg_dependencies:\n    - git\n    - curl\n    - python-dev\n    - libmysqlclient-dev\n    - graphviz\n    - aspell\n    - clamav\n    - unzip\n\n  php_extensions:\n    - php5-mysql\n    - php5-intl\n    - php5-xmlrpc\n    - php5-pspell\n    - php5-curl\n    - php5-gd\n    - php5-ldap\n\u003c/pre\u003e\n\nFor Moodle itself we need to specify preferred database access parameters,\ndomain you plan to assign for the Moodle instance, preferred location.\nAlso you might want to check what is the most recent stable Moodle version and\nspecify it as well.\n\u003cpre\u003e\n  moodle_db_type: 'mysqli' #  'pgsql', 'mariadb', 'mysqli', 'mssql', 'sqlsrv' or 'oci'\n  moodle_db_host: '{{mysql_host}}'\n  moodle_db_name: 'moodle'\n  moodle_db_user: 'moodle'\n  moodle_db_pass: 'moodle'\n  moodle_app_domain: \"moodle.dev\"\n  moodle_app_root: \"/opt/moodle\"\n  moodle_app_wwwroot: \"{{ moodle_app_root }}/moodle\"\n  moodle_app_datadir: \"{{moodle_app_root}}/moodledata\"\n  moodle_app_plugindir: \"{{moodle_app_root}}/downloadedplugins\"\n  # Check on site - at that moment 30 is recent stable\n  moodle_git_version: \"MOODLE_30_STABLE\"\n  moodle_artifact_baseurl: https://download.moodle.org/download.php/direct/stable30\n  moodle_archive_version: \"moodle-latest-30.tgz\"\n\n  moodle_user: \"{{ansible_user_id}}\"\n\n  moodle_admin_user: \"6NHkm*S!^W4w\"\n\n\u003c/pre\u003e\n\nMoodle can be installed either from git repository or via artifact downloading.\nGit option is believed to be maintained more easily.\n\nWe support both ways here, you set the best for your case\n\u003cpre\u003e\n# Currently git is easiest , also supported: web,\n  option_install_moodle: git\n\u003c/pre\u003e\n\n## Optional MySQL installation\n\nAlthouth Moodle supports multiple databases, MySQL is the most typical and  known database on unix.\nIn order to install MySQl, you will need to specify desired mysql root credentials only.\n\u003cpre\u003e\n  mysql_host: \"127.0.0.1\"\n  mysql_root_user: root\n  mysql_root_password: SOMEROOTSECUREPASSWORD\n\u003c/pre\u003e\n\nMoodle has it's own preferences to MySQL configuration. These are addressed my custom my.cnf template,\nas you could check under that link: https://github.com/ThePrudents/moodle/blob/master/templates/mysql/my.cnf.j2\n\nSelf contained recipe to install MySQL might be found here: https://github.com/ThePrudents/moodle/blob/master/tasks/mysql.yml\n\n## Optional LAMP installation\nFor LAMP we have ability to install apache either in worker or prefork mode.\nThis has impact on PHP: it will be installed either as PHP-FPM or via mod_php apache module.\nNowadays worker is preferable.\n\u003cpre\u003e\n  apache_mode: worker # use prefork or worker variables\n  apache2_disable_default: true\n\n  php_family: default # 5.4 | 5.5 | 5.6 | default\n\u003c/pre\u003e\n\nYou might want to check recipes to install Apache (https://github.com/ThePrudents/moodle/blob/master/tasks/apache.yml)\nand PHP (https://github.com/ThePrudents/moodle/blob/master/tasks/php_apache.yml) for more details.\n\nNote, as Moodle requires additional php extensions to be installed, we have introduced additional step,\n as can be checked here: https://github.com/ThePrudents/moodle/blob/master/tasks/php_additional_extensions.yml\n\n## Optional custom Moodle's plugins and themes\nMost of plugins and themes are installed by unzipping archieve to appropriate folders.\nWe could easily automate that process while you need just tell us your preferred plugins information:\n\u003cpre\u003e\n moodle_plugins:\n    - {\n      name: auth_googleoauth2,\n      desc: \"Authentication: Google / Facebook / Github / Linkedin / DropBox / Windows / VK / Battle.net authentication\",\n      url: \"https://moodle.org/plugins/download.php/9695/auth_googleoauth2_moodle30_2015110600.zip\",\n      dest: auth #/googleoauth2\n      }\n    - {\n      name: mod_checklist,\n      desc: \"Activities: Checklist\",\n      url: \"https://moodle.org/plugins/download.php/9703/mod_checklist_moodle30_2015110800.zip\",\n      dest: mod #/checklist\n      }\n    - {\n      name: block_xp,\n      desc: \"Blocks: Level up!\",\n      url: \"https://moodle.org/plugins/download.php/9400/block_xp_moodle30_2015092800.zip\",\n      dest: blocks #/block_xp\n      }\n    - {\n      name: theme_essential,\n      desc: \"Themes: Essential\",\n      url: \"https://moodle.org/plugins/download.php/10342/theme_essential_moodle30_2016010201.zip\",\n      dest: theme #/theme_essential\n      }\n\u003c/pre\u003e\n\n## Install Moodle core components\nOn this step we create Moodle's directories (source, data, plugins), perform\ndatabase configuration, configure Apache virtual host for this instance.\n\nSteps details might be checked at this location:\nhttps://github.com/ThePrudents/moodle/blob/master/tasks/moodle.yml\n\n## Code in action\n\nIn order to be able to run provisioning, we would need ansible and prudentia. Both tools are pure python.\nAnsible is devops toolkit, while prudentia provides some \"synthetic sugar\" to run ansible playbooks easily.\nSee more details on pypi https://pypi.python.org/pypi/prudentia\nFor ubuntu your typical steps to get tools are:\n\u003cpre\u003e\nsudo apt-get install git\nsudo apt-get install python-pip\npip install -U pip\npip install -U ansible==1.9.4\npip install prudentia\n\u003c/pre\u003e\n\nto reuse Moodle role, typical syntax is: (please note, that you may override any role parameter,\nthat makes recipe flexible enough)\n\u003cpre\u003e\n  roles:\n     - {\n         role: \"pr-moodle\",\n         moodle_db_host: '127.0.0.1',\n         moodle_db_name: 'moodle',\n         moodle_db_user: 'moodle',\n         moodle_db_pass: 'yoursupersecurepassword',\n         moodle_app_domain: \"yourdomainname.com\"\n\n       }\n\u003c/pre\u003e\n\nShell file to execute box provisioning\n\u003cpre\u003e\n\n# Static parameters\nWORKSPACE=./\nBOX_PLAYBOOK=$WORKSPACE/boxes/prod.yml\nBOX_NAME=moodle_staging\nBOX_ADDRESS=192.168.0.17\nBOX_USER=youruser\nBOX_PWD=yourpass\n\nprudentia ssh \u0026lt;\u0026lt;EOF\nunregister $BOX_NAME\n\nregister\n$BOX_PLAYBOOK\n$BOX_NAME\n$BOX_ADDRESS\n$BOX_USER\n$BOX_PWD\n\nprovision $BOX_NAME\nEOF\n\u003c/pre\u003e\n\n\n## Running on BlueMix\n\nIBM Bluemix is a cloud platform as a service (PaaS) developed by IBM. It supports several programming languages and\nservices as well as integrated DevOps to build, run, deploy and manage applications on the cloud. One of the services\nprovided called Virtual Machines.\n\nLet's choose ubuntu 14.04.3 LTS image (available from official downloads )\n![Create new vm](https://raw.githubusercontent.com/Voronenko/devops-moodle-box/master/docs/0-bluemix-createvm.png \"Create new vm\")\n\nWe need to allocate public ip address for our instance, and wait it to initialize.\n![Wait for init](https://raw.githubusercontent.com/Voronenko/devops-moodle-box/master/docs/1-bluemix-waitforinit.png \"wait for init\")\n\nDon't forget to configure DNS once you get public ip address from Bluemix platform\n![Don't forget to note ip address](https://raw.githubusercontent.com/Voronenko/devops-moodle-box/master/docs/2-bluemix-noteip.png \"note ip address\")\n\nIt is time to execute provisioning. After executing provisioning, typically you will see successful log of the ansible provisioner.\n\u003cpre\u003e\nTASK: [pr-moodle | Configure Moodle] ******************************************\nchanged: [bluemix.moodle.dev]\n\nTASK: [pr-moodle | Moodle | Set up cron] **************************************\nchanged: [bluemix.moodle.dev]\n\nTASK: [pr-moodle | Moodle | Create Moodle database] ***************************\nchanged: [bluemix.moodle.dev]\n\nTASK: [pr-moodle | Moodle | Create Moodle db user] ****************************\nchanged: [bluemix.moodle.dev]\n\nTASK: [pr-moodle | Moodle | create apache site configuration] *****************\nchanged: [bluemix.moodle.dev]\n\nTASK: [pr-moodle | Moodle | create apache site configuration] *****************\nok: [bluemix.moodle.dev]\n\nTASK: [pr-moodle | Moodle | a2ensite moodle] **********************************\nchanged: [bluemix.moodle.dev]\n\nTASK: [pr-moodle | Moodle | Create directory for downloaded plugins] **********\nchanged: [bluemix.moodle.dev]\n\nTASK: [pr-moodle | Moodle | Download plugins] *********************************\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/9695/auth_googleoauth2_moodle30_2015110600.zip', 'dest': 'auth', 'name': 'auth_googleoauth2', 'desc': 'Authentication: Google / Facebook / Github / Linkedin / DropBox / Windows / VK / Battle.net authentication'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/9703/mod_checklist_moodle30_2015110800.zip', 'dest': 'mod', 'name': 'mod_checklist', 'desc': 'Activities: Checklist'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/9400/block_xp_moodle30_2015092800.zip', 'dest': 'blocks', 'name': 'block_xp', 'desc': 'Blocks: Level up!'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10263/block_progress_moodle30_2016011300.zip', 'dest': 'blocks', 'name': 'block_progress', 'desc': 'Blocks: Progress Bar'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10342/theme_essential_moodle30_2016010201.zip', 'dest': 'theme', 'name': 'theme_essential', 'desc': 'Themes: Essential'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10165/theme_academi_moodle30_2015122500.zip', 'dest': 'theme', 'name': 'theme_academi', 'desc': 'Themes: Academi'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10321/theme_eguru_moodle30_2015122800.zip', 'dest': 'theme', 'name': 'theme_eguru', 'desc': 'Themes: Eguru'})\n\nTASK: [pr-moodle | Moodle | Create directory for downloaded plugins] **********\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/9695/auth_googleoauth2_moodle30_2015110600.zip', 'dest': 'auth', 'name': 'auth_googleoauth2', 'desc': 'Authentication: Google / Facebook / Github / Linkedin / DropBox / Windows / VK / Battle.net authentication'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/9703/mod_checklist_moodle30_2015110800.zip', 'dest': 'mod', 'name': 'mod_checklist', 'desc': 'Activities: Checklist'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/9400/block_xp_moodle30_2015092800.zip', 'dest': 'blocks', 'name': 'block_xp', 'desc': 'Blocks: Level up!'})\nok: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10263/block_progress_moodle30_2016011300.zip', 'dest': 'blocks', 'name': 'block_progress', 'desc': 'Blocks: Progress Bar'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10342/theme_essential_moodle30_2016010201.zip', 'dest': 'theme', 'name': 'theme_essential', 'desc': 'Themes: Essential'})\nok: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10165/theme_academi_moodle30_2015122500.zip', 'dest': 'theme', 'name': 'theme_academi', 'desc': 'Themes: Academi'})\nok: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10321/theme_eguru_moodle30_2015122800.zip', 'dest': 'theme', 'name': 'theme_eguru', 'desc': 'Themes: Eguru'})\n\nTASK: [pr-moodle | Moodle | Unpack plugins] ***********************************\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/9695/auth_googleoauth2_moodle30_2015110600.zip', 'dest': 'auth', 'name': 'auth_googleoauth2', 'desc': 'Authentication: Google / Facebook / Github / Linkedin / DropBox / Windows / VK / Battle.net authentication'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/9703/mod_checklist_moodle30_2015110800.zip', 'dest': 'mod', 'name': 'mod_checklist', 'desc': 'Activities: Checklist'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/9400/block_xp_moodle30_2015092800.zip', 'dest': 'blocks', 'name': 'block_xp', 'desc': 'Blocks: Level up!'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10263/block_progress_moodle30_2016011300.zip', 'dest': 'blocks', 'name': 'block_progress', 'desc': 'Blocks: Progress Bar'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10342/theme_essential_moodle30_2016010201.zip', 'dest': 'theme', 'name': 'theme_essential', 'desc': 'Themes: Essential'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10165/theme_academi_moodle30_2015122500.zip', 'dest': 'theme', 'name': 'theme_academi', 'desc': 'Themes: Academi'})\nchanged: [bluemix.moodle.dev] =\u003e (item={'url': 'https://moodle.org/plugins/download.php/10321/theme_eguru_moodle30_2015122800.zip', 'dest': 'theme', 'name': 'theme_eguru', 'desc': 'Themes: Eguru'})\n\nTASK: [pr-moodle | UFW | Allow incoming http \u0026 https] *************************\nskipping: [bluemix.moodle.dev] =\u003e (item=http)\nskipping: [bluemix.moodle.dev] =\u003e (item=https)\n\nTASK: [Common setup | Preventing ucf to ask information] **********************\nskipping: [bluemix.moodle.dev]\n\nTASK: [Common setup | Message of the day explaining server is under Prudentia control] ***\nchanged: [bluemix.moodle.dev]\n\nTASK: [Common setup | Install common apt packages] ****************************\nchanged: [bluemix.moodle.dev] =\u003e (item=build-essential,reptyr,htop,curl,python-software-properties,python-httplib2)\n\nNOTIFIED: [pr-moodle | restart apache2] ***************************************\nchanged: [bluemix.moodle.dev]\n\nPLAY RECAP ********************************************************************\nbluemix.moodle.dev         : ok=60   changed=52   unreachable=0    failed=0\n\nPlay run took 3 minutes\n\u003c/pre\u003e\n\nAs you see, less in 5 minutes we have our moodle ready for configuration.\n\nUpon navigation to site we will see initial moodle start screen\n\n![Initial screen](https://raw.githubusercontent.com/Voronenko/devops-moodle-box/master/docs/3-bluemix-firstrun.png \"Initial screen\")\n\nAs we see - box is configured correctly.\n![Box configured correctly](https://raw.githubusercontent.com/Voronenko/devops-moodle-box/master/docs/4-bluemix-requirements.png \"Box configured correctly\")\n\nInitial setup goes smoothly\n![Box configured correctly](https://raw.githubusercontent.com/Voronenko/devops-moodle-box/master/docs/5-initial-setup.png \"Box configured correctly\")\n\n\nAs we see all custom plugins and themes are in place, for example \"Blocks: Level up!\":\n![Blocks: Level up! is present](https://raw.githubusercontent.com/Voronenko/devops-moodle-box/master/docs/6-customplugins-present.png \"Blocks: Level up! is present\")\n\n## What can be improved.\n\nideally, recipe can be extended to be fully non-interactive. Moodle seems to allow such setup in the future (looking at install.php)\nUnfortunately, at present moment documentation does not provide clean way how to do it, unless you script configuration \u0026 DB of the existing moodle.\n\nReaders are welcome to advise on options.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoronenko%2Fdevops-moodle-box","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoronenko%2Fdevops-moodle-box","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoronenko%2Fdevops-moodle-box/lists"}