What is the fastest method to reload vagrant after changing a provisioning script ?
I am actually copying the file "mysql.sql" to the guest machine, in "Vagrant":
config.vm.provision "file", source: "mysql.sql", destination: "mysql.sql"
and call it from "bootstrap.sh":
mysql -h localhost -u root -proot < /home/vagrant/mysql.sql
I used to use:
vagrant destroy
vagrant up
vagrant provision
vagrant ssh
I tried to see if:
vagrant reload
will do the same thing, but I am not sure about this, since my modifications happens on the .sql file and not in the Vagrant file.
You can run vagrant reload --provision to run your provisioner.
Provision
On the first
vagrant upthat creates the environment, provisioning is run. If the environment was already created and the up is just resuming a machine or booting it up, they won't run unless the--provisionflag is explicitly provided.When
vagrant provisionis used on a running environment.When
vagrant reload --provisionis called. The --provision flag must be present to force provisioning.
P.S. A bug was fix in Vagrant 1.7.2, if you have a error during vagrant reload --provision, you car rm .vagrant/machines/default/virtualbox/synced_folders and after run vagrant provision.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With