I’ve done it with this Vagrantfile: https://gist.github.com/swalkinshaw/fcb08adfaf86a4be0806
You need this plugin installed: https://github.com/smdahlen/vagrant-digitalocean and the proper DO env vars set up as seen in the Vagrantfile for api keys etc.
But it requires more configuration that I don’t have right now. The prod box references a new prod.yml playbook instead of the normal site.yml. It’s basically the same but doesn’t run the wordpress-sites role.
So the steps would be something like this:
- Run
vagrant prod up --no-provision - Create a prod specific
prod.ymlplaybook with the roles you want - Create a new
hostsfile with a[wordpress-server-prod]group and the DO ip/host - You could move the
group_vars/allto be env specific atgroup_vars/wordpress-server-prodandgroup_vars/wordpress-serverif you only want those vars to apply to each server - Run
vagrant prod provision - Update Capistrano configs with the correct prod ip/host
- Run
cap production deploy
The steps are something like that…
Honestly I don’t think production servers should be managed with Vagrant. Maybe if you want a remote dev server. I’d probably just set up the servers manually (if you only have 1 per site or 1 total) and then run ansible-playbook -i prod.yml hosts manually.