Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant Synced Folder without reload?

Tags:

vagrant

I have a file on my host located at ~/ansible/provisioning/playbook.yml that corresponds to /vagrant/provisioning/playbook.yml on the guest. Every time I make changes to the file on the host, the changes do not show up on the guest unless I run vagrant reload which completely restarts the VirtualBox VM. Is there another way to get files to sync in real time using another filesystem type (NFS perhaps)? My host is MacOS, guest is CentOS 7. I am using vagrant version 2.0.0.

Edit:

I have included my Vagrantfile on pastebin. Yes, it appears I am using rsync.

$ cat .vagrant/machines/default/virtualbox/synced_folders 
{"rsync":{"/vagrant":{"type":"rsync","guestpath":"/vagrant","hostpath":"/Users/timothy/Desktop/code/ansible","disabled":false,"__vagrantfile":true,"owner":"vagrant","group":"vagrant"}}}

In addtion to adding config.vm.synced_folder ".", "/vagrant", type: "virtualbox" to my Vagrantfile, I also had to run $ vagrant plugin install vagrant-vbguest

like image 250
Timothy Pulliam Avatar asked Sep 15 '17 02:09

Timothy Pulliam


1 Answers

as thought rsync is enabled, the box centos/7 has rsync by default, this has been discussed before

When using rsync, you can turn the rsync-auto command to automatically push any new changes from the host to the VM.

If you want to use default virtual box shared folder feature, you can add the following in your Vagrantfile

config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
like image 148
Frederic Henri Avatar answered Sep 28 '22 00:09

Frederic Henri