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

Since upgrade to vagrant 2.0.1, my hostnames are assigned to 127.0.0.1 #250

Open
tcataldo opened this issue Dec 18, 2017 · 7 comments
Open

Comments

@tcataldo
Copy link

The real ip (obtained from vmware dhcp) was assigned correctly with previous version.
example VagrantFile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Ensure that VMWare Tools recompiles kernel modules
# when we update the linux images
$fix_vmware_tools_script = <<SCRIPT
mkdir -p /etc/vmware-tools
touch /etc/vmware-tools/locations
sed -i.bak 's/answer AUTO_KMODS_ENABLED_ANSWER no/answer AUTO_KMODS_ENABLED_ANSWER yes/g' /etc/vmware-tools/locations
sed -i 's/answer AUTO_KMODS_ENABLED no/answer AUTO_KMODS_ENABLED yes/g' /etc/vmware-tools/locations
SCRIPT

Vagrant.configure(2) do |config|
  config.vm.box = "tcataldo/ubuntu1604"

  config.vm.synced_folder ".", "/vagrant", type: "nfs"
  config.hostmanager.enabled = true
  config.hostmanager.manage_host = true
  config.hostmanager.ignore_private_ip = false

  config.vm.provider "vmware_fusion" do |v|
    v.vmx["memsize"] = "512"
    v.vmx["numvcpus"] = "2"
    v.vmx["ethernet0.pcislotnumber"] = "33"
  end

  config.vm.define 'mapi' do |node|
    node.vm.hostname = 'mapi.ex2016.vmw'
    node.hostmanager.aliases = %w(autodiscover.ex2016.vmw)
    node.vm.provision "shell", inline: $fix_vmware_tools_script
    node.vm.provision "nginx", type: "shell", path: "nginx-ews.sh"
  end

end
@punkrokk
Copy link

I'm experiencing the same thing.

@bdwyertech
Copy link

bdwyertech commented Dec 18, 2017

This has to do with a behavior change in the VMware plugin itself... I noticed it a while back too.

hashicorp/vagrant#9151

This is hack to keep it from getting in the way for now...

    config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
      if vm.id && vm.provider_name == :vmware_fusion
        `'/Applications/VMware Fusion.app/Contents/Library/vmrun' getGuestIPAddress "#{vm.id}" -wait`.chomp
      end
    end

Adding -wait to the vmrun command seems to have eliminated the issue on first boot.

@punkrokk
Copy link

punkrokk commented Dec 18, 2017 via email

@Ilhicas
Copy link

Ilhicas commented Mar 29, 2018

The same is happening to me with docker on version 2.0.2 , are you sure this is VMware related only issue? I could be messing something up.

@Ilhicas
Copy link

Ilhicas commented Apr 4, 2018

Just adding this issue is not only vmware related as I asked before and is vagrant version related
https://github.com/devopsgroup-io/vagrant-hostmanager/issues/257

@rgarrigue
Copy link

I've the same issue if I enable dhcp instead of static IP

config.vm.network "private_network", type: "dhcp"

Tried playing with hostmanager options without success.

@cdarlint
Copy link

according to documentation
as referenced in an official reply

setting v.ssh_info_public = true would solve the problem

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

No branches or pull requests

6 participants