How to work on Windows as a Linux developer with Vagrant and Ansible?

I wrote an article recently for explaining why we should use Vagrant developing your PHP projects but it is just a part of the story. If you are a developer that doing development stuff on Windows and had to play with the tools like Ansible or Capistrano, you will met a lot of problems with managing versions of Ruby, Python.

I had a chance to learn and use Ansible to provision my Virtual Machine using Vagrant then falling in love with this simple automation tool. But as you know, Ansible is not well-supported Windows.

When I start a new project, how can I provision staging server to deploy my updated changes? How can I provision multiple production servers when scaling when need?

I had an idea to put all projects into a workspace folder and enable this machine to see all projects inside VM.


workspace structure
Please follow the instructions here and you will be in love with this development stack.

#open gitbash
cd yourworkspace
git [email protected]:giappv/vagrant_ansible.git
cd vagrant_ansible
vagrant plugin install vagrant-hostmanager
vagrant up

After creating VM successfully with Vagrant, these are commands that you use frequently for working inside your workspace.

#open your gitbash on Windows
cd yourworkspace/vagrant_ansible
vagrant up
eval $(ssh-agent) # for create an agent id
ssh-add #for adding agent id you created to transfer environment variables from Windows to your VM
vagrant ssh
# your are in Linux now
cd /vagrant #it is mounted to your workspace folder
# doing something such as provisioning your AWS Instance
ansible-playbook -i pathtoplaybookinventory pathtoplaybook.yml

You can share your deployment stack with your team member on Linux (which is well-supported) so they will not have to spend time of installing bunch of software but not able to work because of their Windows version is not supported.