vagrant-hostmanager
vagrant-hostmanager copied to clipboard
Hostfile on host not updated on destroy of a running machine
Vagrant: 1.7.2 Hostmanager: 1.6.0 Provider: Virtualbox 4.3.30 Host OS: OSX 10.9.5 Guest OS: Ubuntu 14.04
On vagrant up, the hostfile entries are created on both host and guest, but on vagrant destroy (without halt, suspend, or any other machine action), the entries are not removed from the host.
The relevant lines from my Vagrantfile:
Vagrant.configure("2") do |config|
config.hostmanager.enabled = true
config.hostmanager.include_offline = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.manage_host = true
config.vm.box = "ubuntu/trusty64"
config.vm.define :local do |box|
box.vm.hostname = "local.site1.com"
box.vm.network :private_network, ip: "192.168.12.126"
box.vm.network :forwarded_port, guest: 22, id: 'ssh', host: 2126, auto_correct: true
end
config.vm.provision :hostmanager
end
+2 here Doesn't clean host OS hosts file OS X 10.9.4 Windows 7 x64
I can confirm it.
Vagrant: 1.7.4 Hostmanager: 1.6.1 Provider: Virtualbox 5 Host OS: OSX 10.11 Guest OS: Ubuntu 14.04
/etc/hosts file is updated when running either vagrant up or vagrant destroy
This is my Vagrantfile https://github.com/radub/roadster/blob/master/Vagrantfile
I have the same problem on OSX.
Along with the sudoers mod, i even gave write permissions to myself on /etc/hosts just to be sure.
sudo chmod +a "$USER allow read,write" /etc/hosts
.. because it looks like it is trying to remove itself in both places (guest and host), but it just won't do anything. My guess was permission problems, though it does write on "vagrant up" so i don't think that is the case.
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
==> default: Updating /etc/hosts file on active guest machines...
==> default: Updating /etc/hosts file on host machine (password may be required)...
The entry remains.
Vagrant: 1.8.1 Hostmanager: 1.8.1 Provider: VirtualBox 4.3.6 Host OS: OSX 10.11.3 Guest OS: Ubuntu 14.04 trusty32