The included Vagrantfile will allow you to get up and running with a development box quickly.
The following applications must already be installed:
- Vagrant 1.6.5
- VirtualBox
A typical folder structure for a project would look like the following:
ansible/
.. Contents of <http://github.com/simoncoulton/ansible>
secure/
.. Secure files required for deployments (used by Ansible), should not be included in your repo.
source/
app/
public/
css/
img/
js/
vagrant/
.. Contents of this repo
The Ansible repo provides a vagrant
playbook and role to use when provisioning the VM. There are several things that must be setup in order to install the required applications:
- Modify the group_vars.
PHP, uWSGI, Apache, Nginx, MySQL and PostreSQL roles are all run based upon the a configuration variable being set (php, uwsgi, apache, nginx, mysql, postgresql respectively). Simply set each one you want to install to True in your group_vars.
- Create a
secure/vars/database.yml
andsecure/vars/web.yml
file.
These will be used for specific secure settings that you want to keep outside of your repository.
- Create the vagrant configuration
This will replace the VMs webserver virtualhost configuration with one designed specifically for the VM. Examples can be seen in http://github.com/simoncoulton/ansible under roles/vagrant/defaults/main.yml
. Create the relevant config in the vagrant.yml group_var.
Once you've created the above folder structure and cloned the relevant repositories, open your terminal, navigate to the folder, and enter vagrant up
. This will begin the initialization process, creating the VM with Ubuntu 14.04 LTS, and provisioning it with the applications required (see Customizing the VM).
The source/
folder will be mapped to /var/www
with your webserver automatically pointing to /var/www/public
as the root. The VM will be given a static IP address of 192.168.10.145 and a hostname of dev.