josenk / vagrant-vmware-esxi

A Vagrant plugin that adds a vmware ESXi provider support.
GNU General Public License v3.0
416 stars 108 forks source link

Wrong password used when creating Ansible inventory for hosts provisioned on different ESXi servers with different passwords #33

Closed jbregman closed 6 years ago

jbregman commented 6 years ago

Vagrant Version: 2.0.1 Plugin Version: 2.2.1beta Client O/S: Mac OSX 10.12.6

In my Vagrant file, I have some hosts that are configured to use one ESX1 server (server1), and some hosts that are configured to use another ESXi server (server2).

When the Ansible provisioner runs, I get an authentication error:

/opt/vagrant/embedded/gems/gems/net-ssh-4.1.0/lib/net/ssh.rb:250:in `start': Authentication failed for user root@192.168.10.4 (Net::SSH::AuthenticationFailed)
    from /Users/josh.bregman/.vagrant.d/gems/2.4.2/gems/vagrant-vmware-esxi-2.2.1beta/lib/vagrant-vmware-esxi/action/read_state.rb:79:in `read_state'
    from /Users/josh.bregman/.vagrant.d/gems/2.4.2/gems/vagrant-vmware-esxi-2.2.1beta/lib/vagrant-vmware-esxi/action/read_state.rb:17:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.0.1/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/josh.bregman/.vagrant.d/gems/2.4.2/gems/vagrant-vmware-esxi-2.2.1beta/lib/vagrant-vmware-esxi/action/esxi_password.rb:18:in `call'

I added some debugging information and it looks like the issue is that there is a single global password stored in $esxi_password.

This passwords for server1 and server2 are different so this is likely why this is failing.

josenk commented 6 years ago

Yes, I believe you are right... The global variable will be used for both ESXi servers. I have a single esxi server and never really thought people would do multimachines using more than one esxi host (with different passwords). I never tested this configuration. This should be fixable by storing the password differently. I'll have a new beta for you shortly.

josenk commented 6 years ago

If you could please test this beta, it would be appreciated. Just uninstall the old plugin, and install this beta. Let me know how it works out...

$ wget https://dc002.jintegrate.co:/89ki37392937y4/vagrant-vmware-esxi-2.2.1beta2.gem $ vagrant plugin uninstall vagrant-vmware-esxi $ vagrant plugin install vagrant-vmware-esxi-2.2.1beta2.gem

josenk commented 6 years ago

2.2.1 has been released.