Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution of hostmanager during vagrant reload #185

Open
papadi opened this issue Apr 8, 2016 · 6 comments
Open

Execution of hostmanager during vagrant reload #185

papadi opened this issue Apr 8, 2016 · 6 comments

Comments

@papadi
Copy link

papadi commented Apr 8, 2016

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.

@seth-reeser
Copy link
Member

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.

@papadi
Copy link
Author

papadi commented Apr 14, 2016

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! :)

@madsem
Copy link

madsem commented May 4, 2016

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.

@papadi
Copy link
Author

papadi commented May 4, 2016

I ended up creating a batch file for this.

@cheoAlejo
Copy link

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

@LastDragon-ru
Copy link

LastDragon-ru commented Apr 4, 2020

Seems this works :)

config.hostmanager.enabled = true
config.vm.provision :hostmanager, run: 'always'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants