Dynamic Vagrant Shares14 May 2014
At SugarCRM, we are deploying Vagrant stacks as part of the DevOps Initiative. How ever we ran into a few problems with defining shares. Since no two engineers work the same or have the same setup we couldn’t define shares that were hard coded in the Vagrantfile. We had to come up with a way to do shares that end user could customize easily. While looking for solutions someone pointed out that the Vagrantfile is just Ruby and we could use YAML to define the shares. The seed had been planted and this is the bit of code we came up with.
Place this bit of code inside the Vagrantfile:
This method allows the user to create a share.yaml next to the Vagrantfile, which it will then be picked up and converted into the config.vm.synced_folder attribute when then
vagrant up or
vagrant reload command is issued.
Hope this helps others!