GithubHelp home page GithubHelp logo

Comments (22)

Spots avatar Spots commented on July 19, 2024 1

override.vm.network 'private_network', ip: '10.161.68.209' shouldnt be in there. It should be outside the vagrant block.

config.vm.network 'private_network', ip: '10.161.68.209'

At least that's how mine is working.

from vagrant-vsphere.

rylarson avatar rylarson commented on July 19, 2024

Just so I can stay sane reading it ;) :

Vagrant.configure("2") do |config|
  config.vm.box = 'dummy'
  config.vm.box_url = 'dummy.box'

  config.vm.provider :vsphere do |vsphere|
    vsphere.host = '{vSphere host}'
    vsphere.data_center_name = 'Datacenter'
    vsphere.compute_resource_name = '{Cluster}
    vsphere.template_name = 'Template 1'
    vsphere.user = 'Vagrant'
    vsphere.password = 'xxxxx'
    vsphere.insecure = 'true'
    vsphere.data_store_name = 'LUN 11'
    vsphere.customization_spec_name = 'NE Template'
    config.vm.network 'private_network', ip: '192.168.1.200'
  end
end

Does your customization spec have a network adapter configured? If not, it won't work.

Also just a tip, you should not change the top level config object inside of a provider configuration block. If you need to change things on the global config on a per provider basis, you can use the override:

config.vm.provider :vsphere do |vsphere, override|
  override.vm.network 'private_network', ip: '192.168.1.200'
end

from vagrant-vsphere.

tomav avatar tomav commented on July 19, 2024

I can reproduce your problem when the specification is on DHCP mode and when you also provide an IP address. I'm struggling with the same issue.

from vagrant-vsphere.

tomav avatar tomav commented on July 19, 2024

Anyone figured out how to setup an IP to a Linux box?

from vagrant-vsphere.

y4roslav avatar y4roslav commented on July 19, 2024

I have the same issue. Any success ?

from vagrant-vsphere.

dataplayer avatar dataplayer commented on July 19, 2024

What happens if you set the config.vm.network object inside the config block, like this:

Vagrant.configure("2") do |config|
  config.vm.box = 'dummy'
  config.vm.box_url = 'dummy.box'
  config.vm.network 'private_network', ip: '192.168.1.200'

  config.vm.provider :vsphere do |vsphere|
    vsphere.host = '{vSphere host}'
    vsphere.data_center_name = 'Datacenter'
    vsphere.compute_resource_name = '{Cluster}
    vsphere.template_name = 'Template 1'
    vsphere.user = 'Vagrant'
    vsphere.password = 'xxxxx'
    vsphere.insecure = 'true'
    vsphere.data_store_name = 'LUN 11'
    vsphere.customization_spec_name = 'NE Template'
  end
end

from vagrant-vsphere.

y4roslav avatar y4roslav commented on July 19, 2024

@dataplayer I see you point.

vsphere.customization_spec_name = 'NE Template'

Now I understand this section in docs 👍

The IP address will only be set if a customization spec name is given. The customization spec must have network adapter settings configured. For each private network specified, there needs to be a corresponding network adapter in the customization spec. An error will be thrown if there are more networks than adapters.

Thank you

from vagrant-vsphere.

y4roslav avatar y4roslav commented on July 19, 2024

@dataplayer I added template with two NIC (dhcp and prompt user) and got the same issue:

INFO interface: error: undefined method `ipAddress=' for #  <RbVmomi::VIM::CustomizationDhcpIpGenerator:0x0000010136d5d8>
undefined method `ipAddress=' for #<RbVmomi::VIM::CustomizationDhcpIpGenerator:0x0000010136d5d8>
INFO interface: Machine: error-exit ["VagrantPlugins::VSphere::Errors::VSphereError", "undefined  method `ipAddress=' for #<RbVmomi::VIM::CustomizationDhcpIpGenerator:0x0000010136d5d8>"]

from vagrant-vsphere.

Spots avatar Spots commented on July 19, 2024

I was able to get it to work. I set a static IP(just an unused address) in my vsphere customization spec, and then configured the ip in the Vagrant file as documented. After issuing the 'vagrant up' it set the new vm's IP to the one in the config and not the one in the customization spec.

from vagrant-vsphere.

umatomba avatar umatomba commented on July 19, 2024

@Spots
it's also my solution in this case)

from vagrant-vsphere.

linksonice avatar linksonice commented on July 19, 2024

The following is my Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = 'dummy'
  config.vm.box_url = 'dummy.box'

  config.vm.provider :vsphere do |vsphere, override|
    vsphere.host = 'my-vsphere-server-host'
    vsphere.name = 'my-hostname'
    # vsphere.data_center_name = 'Datacenter'
    vsphere.compute_resource_name = 'FM&T Dev Cluster'
    vsphere.template_name = 'Templates/t-centos66-vagrant'
    vsphere.user = 'username'
    vsphere.password = 'password'
    vsphere.insecure = 'true'
    vsphere.data_store_name = 'intopsz1_vmdk'
    vsphere.customization_spec_name = 'centos66'
    override.vm.network 'private_network', ip: '10.161.68.209'
  end
end

Just wondering what else could be going wrong. Is it absolutely necessary to use a ruby v1.9.3 or higher? I seem to be getting results even with the 1.8.7 enterprise ruby, but setting a static IP is the ever elusive holy grail. Apart from that, it matters not if I use "override.vm.network" or "config.vm.network", or if either of the above is in or out of the config bloc - the ip requested is never set, and there's always the "Vagrant::Errors::SSHNotReady" endless loop at the end (a separate issue I suppose). The IP that IS set however (but which still requires the removal of 70-persistent-net-rules and a reboot to activate properly) is the IP I have in BOTH the customisation specification AND the template I am using. This IP is 10.161.68.199 ... but the REQUIRED IP is that specified in the Vagrantfile, which is 10.161.68.209 as indicated above.

Honestly I wouldn't even mind so much if it was necessary to rm the 70-persistent-net-rules file ONCE with a self-deleting bash script on the initial boot or whatever, as long as the static IP specified in the Vagrantfile got set on eth0.

Can anyone see anything obviously wrong here?

Thanks for any ideas, A./

from vagrant-vsphere.

linksonice avatar linksonice commented on July 19, 2024

Spots, you mean it should be outside the config.vm.provider block, and say
"config.vm.network 'private_network', ip: '10.161.68.209'
not
"override.vm.network 'private_network', ip: '10.161.68.209' ?

from vagrant-vsphere.

Spots avatar Spots commented on July 19, 2024

Yes, sorry, got in a hurry and forgot to come back.

Here's a config I just used to launch a box:

 Vagrant.configure(2) do |config|
 config.vm.box = "dummy"
 config.vm.box_url = "./dummy.box"
 config.vm.network 'private_network', ip: '192.168.123.10'

 config.vm.provider :vsphere do |vsphere|
     vsphere.name = 'elk-test'
     vsphere.customization_spec_name = 'Ubuntu-Static'
     vsphere.host = 'myvcenterserver'
     vsphere.data_center_name = 'mydatacenter'
     vsphere.compute_resource_name = 'mycluster'
     vsphere.template_name = 'Ubuntu 14.04 x64 Vagrant with Ansible Template'
     vsphere.data_store_name = 'datastore-temp'
     vsphere.user = 'user'
     vsphere.password = 'password'
   end
 end

In my customization spec I have it set to a specific address(just something I'm not using NOT the address I want the VM to be). The config.vm.network line will overwrite the ip in the customization spec with the one you set.

from vagrant-vsphere.

linksonice avatar linksonice commented on July 19, 2024

Thanks Steve. No cigar yet though, even with your exact vagrantfile as seen in your last post there, but with added "vsphere.insecure = 'true'". I'm thinking it's because my ruby is v1.8.7, so will try a fresh vagrant install tomorrow.

from vagrant-vsphere.

Spots avatar Spots commented on July 19, 2024

:(

For reference I'm using a Ubuntu 14.04 x64. I installed ruby 1.9.3p551 using rbenv. Vagrant version 1.7.1

from vagrant-vsphere.

linksonice avatar linksonice commented on July 19, 2024

Bingo! There was a rather obvious error on my part in the end - which was failing to have a valid vmware-tools on the template. BTW this works with enterprise ruby v.1.8.7 (so having a minimum ruby v.1.9.3 is not a condition after all) and maybe some other, older dependencies I'm not sure, as well as with the most recent recipe described in http://sdorsett.github.io/2014/04/19/vagrant-install/. The OSes we're working with are Centos 6.x.

from vagrant-vsphere.

tizzythegrey avatar tizzythegrey commented on July 19, 2024

great job! @Spots this fixed my issues here as well. I created the specs and added that to my vagrant file and it worked like a charm after hours of headache.

from vagrant-vsphere.

simsunny22 avatar simsunny22 commented on July 19, 2024

i have no idea how to configure the specs
could anyone can give me some help
thanks

from vagrant-vsphere.

ozdanborne avatar ozdanborne commented on July 19, 2024

@Y4Rv1K and anyone else hitting this error:

INFO interface: error: undefined method `ipAddress=' for #  <RbVmomi::VIM::CustomizationDhcpIpGenerator:0x0000010136d5d8>
undefined method `ipAddress=' for #<RbVmomi::VIM::CustomizationDhcpIpGenerator:0x0000010136d5d8>
INFO interface: Machine: error-exit ["VagrantPlugins::VSphere::Errors::VSphereError", "undefined  method `ipAddress=' for #<RbVmomi::VIM::CustomizationDhcpIpGenerator:0x0000010136d5d8>"]

This just means that you have specified more private IP's in your Vagrantfile than the number of existing static IP interfaces in your VSphere spec. Either decrease the number of private IP's, or increase the number of available static interfaces.

from vagrant-vsphere.

simsunny22 avatar simsunny22 commented on July 19, 2024

has anyone encounter the error "NicSettingMismatch: fault.NicSettingMismatch.summary"
could give me some help
thank you

from vagrant-vsphere.

ozdanborne avatar ozdanborne commented on July 19, 2024

@simsunny22 I encountered that when I set more nics in my customization spec than were configured on my template. To remedy that, try converting your template to a powered-off VM, edit-settings, add an additional network device, then convert it back to a template

from vagrant-vsphere.

simsunny22 avatar simsunny22 commented on July 19, 2024

@djosborne
thank you very much ,it works for me
as you said, my vm could start,
but the network is not available, eth0 or eth1 can not start
i have no idea about this
i think is someting wrong when i config my customization spec
but i not konw how to fix this

from vagrant-vsphere.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.