Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reload vagrant after an update

Tags:

mysql

vagrant

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.

like image 469
4m1nh4j1 Avatar asked Nov 01 '25 06:11

4m1nh4j1


1 Answers

You can run vagrant reload --provision to run your provisioner.

Provision

  • On the first vagrant up that 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 --provision flag is explicitly provided.

  • When vagrant provision is used on a running environment.

  • When vagrant reload --provision is 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.

like image 180
acfreitas Avatar answered Nov 02 '25 23:11

acfreitas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!