Open papadi opened 8 years ago
Thank you for the question @papadi - currently vagrant-hostmanager is not invoked during a vagrant reload. Given that a vagrant reload
is equivalent to a vagrant halt
followed by a vagrant up
this would not violate configuration vs state. Please submit a pull request with your proposal.
I'm using Vagrant with HyperV and external network. In this case there is no option other than DHCP and there are cases, when I do Vagrant Reload that the IP of my VM changes. I will take a look at the code and I will see if I can do anything about that pull request. I'm afraid I don't feel confident though! :)
I have this issue as well, in my case it's with the vagrant aws provider tho. Every time I do a vagrant reload, the IP of my aws instance changes and I have to readjust the hosts file manually.
Would love to submit a pull request, but also do not feel confident enough to tackle this just yet.
I ended up creating a batch file for this.
It would be great to have this issue fixed. For instance, in Homestead (the VM for PHP Laravel), you can add new sites (virtual hosts) by adding 2 lines to a yaml file, and the documentation states that you just have to run vagrant reload --provision
. However, the hosts file does not get updated. In order to make it work, you have to run:
vagrant halt
vagrant up --provision
Seems this works :)
config.hostmanager.enabled = true
config.vm.provision :hostmanager, run: 'always'
hostmanager isn't executed when I run vagrant reload. It does work if I execute it manually after vagrant reload by running vagrant hostmanager. Any ideas? Can I make it run during reload too? There is a chance, when using DHCP, that the IP will change during a reload.