And that’s it! The command to kick all these off is:
ansible-playbook -i ansible.inventory provision.ansible.yaml --limit=staging
Lots more info in the
Ansible docs .What to Do Next
I’ve just given a little taster of what’s possible with Ansible. But the more you automate
about your deployments, the more confidence you will have in them. Here’s a few more
things to look into.
Move Deployment out of Fabric and into Ansible
We’ve seen that Ansible can help with some aspects of provisioning, but it can also do
pretty much all of our deployment for us. See if you can extend the playbook to do
everything that we currently do in our fabric deploy script, including notifying the
restarts as required.
Use Vagrant to Spin Up a Local VM
Running tests against the staging site gives us the ultimate confidence that things are
going to work when we go live, but we can also use a VM on our local machine.
Download Vagrant and Virtualbox, and see if you can get Vagrant to build a dev server
on your own PC, using our Ansible playbook to deploy code to it. Rewire the FT runner
to be able to test against the local VM.
Having a Vagrant config file is particularly helpful when working in a team—it helps
new developers to spin up servers that look exactly like yours.
426
|
Appendix C: Provisioning with Ansible