Hey all,
First off, I’ve got to take a moment and thank all the Roots developers for your hard work. In the past few months since I started using Trellis + Bedrock + Sage, my life has become SO much easier. Not only do your products work wonderfully, having a site like Discourse gives me the confidence to use them with clients and not worry about unforeseen bugs / shoddy coding. On to the question…
QUESTION: Is there a specific reason that the current Vagrant setup opts for a static private network IP – config.vm.network :private_network, ip: '192.168.50.5'
– over DHCP?
I never noticed this until I tried to launch more than one Vagrant instance at the same time. Obviously, when I attempted this, Vagrant told me to “go kick rocks” because it would cause a conflict. After I did some digging in the Vagrant documentation, I noticed that they recommended DHCP so that the private network could be automatically generated.
Long story short, I could not ever get the vagrant-hostsupdater plugin to play nice with the new config type – config.vm.network :private_network, type: 'dhcp'
; however, I did have success after I swapped out the vagrant-hostsupdater plugin with vagrant-hostmanager plugin…
if Vagrant.has_plugin?("vagrant-hostmanager")
config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
if hostname = (vm.ssh_info && vm.ssh_info[:host])
`vagrant ssh -c "hostname -I"`.split()[1]
end
end
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
config.hostmanager.aliases = [ aliases, www_aliases ]
else
fail_with_message "vagrant-hostmanager missing, please install the plugin with this command:\nvagrant plugin install vagrant-hostmanager"
end
Thoughts?