This project contains Vagrant and Ansible scripts to provision CentOS7 machines with LearningLocker. The Ansible playbook has been successfully used with RHEL 7 too.
This LearningLocker installation will depend on Apache2 and MongoDB. Note that there is another Vagrant and Ansible script to provision one Ubuntu VM with LearningLocker using nginx which can be found here.
Copy vars.secret.yml.edit file to vars.secret.yml and edit it following the instructions detailed in the file.
Optionally, you might want to edit the files located in the group_vars or the vagrant directories.
This section explains three ways to install LearningLocker:
- Create one VM machine with LL installed.
- Create two VM machines with LL installed: one for the webserver and the other for the database.
- Install LL in existing machines.
To create a virtual machine and provision it with LearningLocker, simply run:
vagrant up
If the installation is completed successfully, you will be able to:
- Access LL through your web browser: http://192.168.35.2
- Connect to the machine:
vagrant ssh
To create a virtual machine and provision it with LearningLocker, simply run:
MACHINES='./vagrant/two_machines' vagrant up
If the installation is completed successfully, you will be able to:
- Access LL through your web browser: http://192.168.35.3
- Connect to the machines:
vagrant ssh ll-webvagrant ssh ll-db
First, you need to create an inventory file specifying the machines that you will use. The inventories directory contains some sample files which can be used as inventory templates.
Then, run Ansible as follows.
ansible-playbook --private-key=[path_to_private_key] --user=[remote_user] -i [path_to_inventory_file] main.yml
If the MongoDB will not run in the same machine as the web server, you should specify it in the following way:
ansible-playbook --extra-vars={"mongodb_host":"[ip-of-the-machine]"} (...)
To provision only the web server run:
ansible-playbook (...) learninglocker.yml
To provision only the database run:
ansible-playbook (...) database.yml
- Ansible throws an error which says:
Missing become password. - What happens? The remote user you are running needs to introduce a password to become sudo.
- Quick solution: Add the
--ask-become-passparameter.
This playbook was made as part of the FORGE project.
To create the Ansible playbook, the steps described by David Pesce here were a great help. Therefore, part of the credit goes to him.