Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which command to get vagrantfile changes on an instance

Tags:

vagrant

I made changes to my Vagrantfile (added config.vm.share_folder, config.vm.customize lines) and now I want them to show up on the box. Do I need to run

vagrant destroy && vagrant up

Or is it sufficient to run

vagrant reload

? I am unclear about whether vagrant reload will read anything from the Vagrantfile, since it seems to shutdown the VM and run the provisioner.

like image 668
Kevin Burke Avatar asked Jun 22 '12 17:06

Kevin Burke


People also ask

Where can I find Vagrantfile?

Explore the synced folder Tip: When you vagrant ssh into your machine, you're in /home/vagrant , which is a different directory from the synced /vagrant directory. Believe it or not, the Vagrantfile that you see inside the virtual machine is actually the same Vagrantfile that is on your actual host machine.

How do I check my vagrant status?

Command: vagrant status [name|id] This will tell you the state of the machines Vagrant is managing. It is quite easy, especially once you get comfortable with Vagrant, to forget whether your Vagrant machine is running, suspended, not created, etc. This command tells you the state of the underlying guest machine.


2 Answers

I don't think you need to destroy your VM. You can make changes to VM configuration when the VM is not running and powered down.

Try using vagrant halt and then vagrant up.

It should make the modifications to the VM as specified in Vagrantfile.

and you could also do vagrant up --no-provision to avoid re-provisioning as you bring up the VM.

and vagrant reload [vm-name] --no-provision should do the same trick.

like image 68
pyfunc Avatar answered Sep 28 '22 07:09

pyfunc


vagrant reload is same as running vagrant halt followed by vagrant up please refer the doc for reload. Here is an excerpt from the doc

"This command is usually required for changes made in the Vagrantfile to take effect. After making any modifications to the Vagrantfile, a reload should be called." So in your case, I would suggest you to only use,

vagrant reload
like image 21
Hamzeen Hameem Avatar answered Sep 28 '22 06:09

Hamzeen Hameem