Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

programatically restart vagrant box after provisioning (Vagrant 1.4+)

Tags:

vagrant

I have some fairly complex provisioning on a box, after which I would like to programatically do the equivalent of vagrant reload.

The best solution I have seen is here, however the code at that link seems to be broken on Vagrant 1.4+ (see the comments below the code).

Question: Are there any instructions for Vagrant 1.4?

like image 726
Chris Snow Avatar asked Jan 13 '14 21:01

Chris Snow


People also ask

How do I restart vagrant?

Command: vagrant reload [name|id] The configured provisioners will not run again, by default. You can force the provisioners to re-run by specifying the --provision flag.

What does vagrant reload -- provision do?

Vagrant reload will reboot the VM, if the VM was provisioned already in the next run reload will skip those by default. vagrant reload --provision will reboot the VM and run the provision steps if any. in the home of the users are a lot of files needed to ssh.

How do I update my vagrant box?

Command: vagrant box update This command updates the box for the current Vagrant environment if there are updates available. The command can also update a specific box (outside of an active Vagrant environment), by specifying the --box flag. Note that updating the box will not update an already-running Vagrant machine.


1 Answers

You could give a try to this Vagrant plugin I've written:

https://github.com/emyl/vagrant-triggers

Once installed, you should put in your Vagrantfile something like:

config.trigger.after :provision, :execute => "vagrant reload"
like image 155
Emyl Avatar answered Dec 25 '22 09:12

Emyl