Reputation: 4356
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.
Upvotes: 4
Views: 8419
Reputation: 1397
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
.
Upvotes: 7