Extra Credit: Makefile Setup - miroswan/vagrant_spec GitHub Wiki
In this section, we will create a Makefile that will ease the execution of the various execution tasks we've done so far.
Create the Makefile
Create a file called Makefile in your Vagrant directory and add the following contents:
default: up install_roles init deploy test
all: up install_roles init deploy test destroy
up:
vagrant up
install_roles:
ansible-galaxy install -r requirements.yml
init:
vagrant spec init
deploy:
ansible-playbook site.yml -i vagrantspec_inventory
test:
vagrant spec test
destroy:
vagrant destroy -f
Note: Be sure to use tabs instead of spaces when working with Makefiles.
Now, we should be able to run make all
within a continuous integration or continuous deployment pipeline prior to releasing any changing to our application. Alternatively, each task can be split into separate pipeline stages. For more information regarding make, go here.