Using template examples I wanted to automate deployment of vm's on vSphere. 
However regardless of what I try, I keep getting the error "Build 
'vsphere-iso.autogenerated_1' errored after 4 seconds 41 milliseconds: 
ServerFaultCode: Cannot complete login due to an incorrect user name or 
password.".

Now, I know for a fact that the username and password are correct. I can 
use the credentials on the vSphere WebUI and they work.

In my hcl, I tried the "Administrator@vsphere.local", with and without 
capitals. I tried without the domain. I tried 
"VSPHERE.LOCAL\Administrator", in different combo's.

I made a local user, added it to administrators. I can login on the webUI 
as either "packer" or "packer@localos".

In vSphere Event Console, I can see this:
User packer@127.0.0.1 logged in as VMware vim-java 1.0

When I use Packer, I see this or something similar:

Cannot login packer@1.2.3.102 Error 12/03/2023, 8:19:56 PM 
esxi.internal.domain.net 
packer vim.event.BadUsernameSessionEvent 
Beginning of Expandable row content Screen reader table commands may not 
work for viewing expanded content, please use your screen reader's browse 
mode to read the content exposed by this button 
Date Time: 
12/03/2023, 8:19:56 PM 
Type: 
Error 
User: 
packer 
Target: 
esxi.internal.domain.net 
Description: 
Cannot login packer@10.2.3.102 
Event Type Description: 
A user attempted to log in with an unknown or invalid username 
Possible Causes: 

   - The username is unknown to the system Action: If you are using Active 
   Directory, check the health of the domain controller 
   - The user provided an invalid password Action: Supply the correct 
   password 
   
Related events: 
There are no related events.

At the start of my hcl file, I declared my variables:
cat packer-test.json.pkr.hcl                                               
                             ─╯
# See https://www.packer.io/docs/templates/hcl_templates/blocks/packer for 
more info
packer {
  required_plugins {
    vsphere = {
      source  = "github.com/hashicorp/vsphere"
      version = "~> 1"
    }
  }
}

# 
https://www.packer.io/docs/templates/hcl_templates/variables#type-constraints 
for more info.
variable "HTTP_IP" {
  type    = string
  default = "10.2.3.10:81"
}

variable "HTTP_PATH" {
  type    = string
  default = "packer-test/ks.cfg"
}

variable "version" {
  type    = string
  default = "0.0.3"
}

variable "vsphere_endpoint" {
  type = string
  default = "1.2.3.13"
}

variable "vsphere_username" {
  type = string
  default = "packer"
}

variable "vsphere_password" {
  type = string
  default = "L3tM3In@once"
}

Does anyone have any idea what is wrong?

Thanks!

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/56f5008f-869f-4558-80b0-eb0bcb520681n%40googlegroups.com.

Reply via email to