-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
Labels
Description
Given the following Vagrant setup, vagrant-hostsupdater produces an invalid /etc/hosts file where different hostnames need to be bound to different IP addresses within the guest:
ip_address_au = "10.0.0.28"
ip_address_nz = "10.0.0.29"
config.vm.network "private_network", ip: ip_address_nz
config.vm.network "private_network", ip: ip_address_au
if Vagrant.has_plugin?("vagrant-hostsupdater")
config.hostsupdater.aliases = ["foo.com", "bar.com"}
end
...The /etc/hosts file will look something like:
10.0.0.28 foo.com # VAGRANT: 76d2a8f38ca5dad7d0414a3dc013813c (default) / 234b3f77-7624-4b98-8ce1-5560abeb4ff7
10.0.0.28 bar.com # VAGRANT: 76d2a8f38ca5dad7d0414a3dc013813c (default) / 234b3f77-7624-4b98-8ce1-5560abeb4ff7
10.0.0.29 foo.com # VAGRANT: 72750f9e895980fb84e2792fd10a90f3 (default) / 5571d2f0-bb3e-4897-b151-394a8db63b05
10.0.0.29 foo.com # VAGRANT: 72750f9e895980fb84e2792fd10a90f3 (default) / 5571d2f0-bb3e-4897-b151-394a8db63b05b
It would be great if support for mapping IPs to hostnames were added:
e.g. a syntax something like:
config.hostsupdater.aliases = {ip_address_au => ["foo.com"], ip_address_nz => ["bar.com"]}
would produce a hosts file like:
10.0.0.28 foo.com # VAGRANT: 76d2a8f38ca5dad7d0414a3dc013813c (default) / 234b3f77-7624-4b98-8ce1-5560abeb4ff7
10.0.0.29 bar.com # VAGRANT: 72750f9e895980fb84e2792fd10a90f3 (default) / 5571d2f0-bb3e-4897-b151-394a8db63b05b