vagrant ansible

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

I wrote an article recently explaining why we should use Vagrant to develop your PHP projects, but that is just part of the story. If you’re a developer working on Windows and need to use tools like Ansible or Capistrano, you’ll run into a lot of issues managing Ruby and Python versions.

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

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

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

I had an idea to put all projects into a workspace folder and enable this machine to see all projects inside VM.
Please follow the instructions here and you will fall 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
cd yourproject.com
# 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 installing a bunch of software that is not able to work because their Windows version is not supported.