Search code examples
amazon-web-serviceschef-infravagrantrsync

How to manually trigger rsync using vagrant and vagrant-aws?


I'm using Vagrant to deploy chef scripts to an AWS server (and it mostly works awesome). I have set up a local rsync in my Vagrantfile to mirror my dev directory onto the server.

config.vm.synced_folder "../geoevents", "/vagrant/geoevents-repo"

And this syncs find on 'vagrant provision'. I'm wondering if there is an easier way that I can have vagrant only trigger that rsync, or to control how often rsync occurs?

Or, should I not be using rsync, but instead mount a shared file system?


Solution

  • Vagrant CLI now has two new commands, vagrant rsync and vagrant rsync-auto which can do the job.

    Command: vagrant rsync

    This command forces a re-sync of any rsync synced folders.

    Note that if you change any settings within the rsync synced folders such as exclude paths, you will need to vagrant reload before this command will pick up those changes.

    https://www.vagrantup.com/docs/cli/rsync.html

    https://www.vagrantup.com/docs/cli/rsync-auto.html

    https://www.vagrantup.com/docs/cli/non-primary.html