Skip to content

post-processor vsphere: Handle prompts from ovftool when using custom CA #297

@goldstar611

Description

@goldstar611

Overview of the Issue

hashicorp/packer#7314 closed hashicorp/packer#7234, for error message: Write 'yes' or 'no'.

I recently upgraded my packer version and started using the plugins and this "write yes or no" message appears endlessly in the packer log.

Adding --noSSLVerify to ovftool parameters resolves the endless, interactive prompts.

Reproduction Steps

  1. Set up vcenter with an ESXi host OR set up nginx/apache server with a self signed SSL Cert (reproduction only) the real issue is when a custom CA bundle is being used.
  2. Create a packer template that uses the vshpere post-processor and targets the above server
  3. Wait for packer to finish building the VM and upload to the vcenter endpoint
  4. Endless interactive prompt Write 'yes' or 'no' will be displayed until the packer process is killed (Ctrl+C)

Packer Version

1.9.2

Plugin Version and Builders

Please provide the plugin version.

vsphere 1.0
vmware 1.0

Please select the builder.

  • vsphere-iso

VMware vSphere Version

7.0

Guest Operating System

Windows 10

Simplified Packer Buildfile

Packer Buildfile
  packer {
    required_plugins {
      vmware = {
        source  = "github.com/hashicorp/vmware"
        version = "~> 1"
      }
      vsphere = {
        source  = "github.com/hashicorp/vsphere"
        version = "~> 1"
      }
    }
  }
  
  variable "iso_checksum" {
    type    = string
    default = "send_via_command_line"
  }
  
  variable "iso_url" {
    type    = string
    default = "send_via_command_line"
  }
  
  source "vmware-iso" "autogenerated_1" {
    boot_command         = []
    boot_wait            = "15m"
    communicator         = "winrm"
    cpus                 = "2"
    disk_adapter_type    = "lsisas1068"
    disk_size            = "61440"
    disk_type_id         = "1"
    floppy_files         = ["./windows/10/answer_files/", "./windows/10/scripts/"]
    guest_os_type        = "windows9-64"
    headless             = "false"
    http_directory       = "./windows/10/tools/"
    iso_checksum         = "${var.iso_checksum}"
    iso_url              = "${var.iso_url}"
    memory               = "4096"
    network              = "nat"
    network_adapter_type = "E1000E"
    shutdown_command     = "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\""
    shutdown_timeout     = "45m"
    version              = 14
    vm_name              = "temp_windows10x64_packer"
    vmx_data = {
      "RemoteDisplay.vnc.enabled"    = "false"
      "RemoteDisplay.vnc.port"       = "5900"
      "isolation.tools.hgfs.disable" = "true"
      "mks.enable3d"                 = "true"
      "tools.upgrade.policy"         = "manual"
    }
    vmx_remove_ethernet_interfaces = false
    vnc_port_max                   = 5980
    vnc_port_min                   = 5900
    winrm_password                 = "winrm_password"
    winrm_timeout                  = "60m"
    winrm_username                 = "winrm_username"
  }
  
  build {
    sources = ["source.vmware-iso.autogenerated_1"]
  
    post-processor "vsphere" {
      cluster    = "blah"
      datacenter = "Network"
      datastore  = "datastore"
      host       = "vcenter"
      overwrite  = true
      password   = "PASSWORD"
      username   = "user"
      vm_folder  = "vmFolder"
      vm_name    = "temp_windows10x64_packer"
      vm_network = "network"
    }
  }

Operating System and Environment Details

Debian 12

Log Fragments and crash.log Files

ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Calling OVFtool to upload vmESC[0m

2023/08/01 15:29:58 packer-plugin-vsphere_v1.2.1_x5.0_linux_amd64 plugin: 2023/08/01 15:29:58 [INFO] (vsphere): starting ovftool command: ovftool --acceptAllEulas --name=windows10x64_packer --datastore=datastore --diskMode=thick --vmFolder=vmFolder --network=network --overwrite output-autogenerated_1/temp_windows10x64_packer.vmx vi://user%40vcenter:PASSWORD@vcenter/Network/host/blah

2023/08/01 15:29:58 packer-plugin-vsphere_v1.2.1_x5.0_linux_amd64 plugin: 2023/08/01 15:29:58 [INFO] (shell-local communicator): Executing local shell command [ovftool --acceptAllEulas --name=windows10x64_packer --datastore=datastore --diskMode=thick --vmFolder=vmFolder --network=network --overwrite output-autogenerated_1/temp_windows10x64_packer.vmx vi://user%40vcenter:PASSWORD@vcenter/Network/host/blah]
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Opening VMX source: output-autogenerated_1/temp_windows10x64_packer.vmxESC[0m
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Accept SSL fingerprint (AA:BB:CC:DD:EE:FF:AA:BB:CC:DD:EE:FF:AA:BB:CC:DD:EE:FF:AA:BB) for host vcenter as target type.ESC[0m
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Fingerprint will be added to the known host fileESC[0m
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Write 'yes' or 'no'ESC[0m
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Write 'yes' or 'no'ESC[0m
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Write 'yes' or 'no'ESC[0m
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Write 'yes' or 'no'ESC[0m
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Write 'yes' or 'no'ESC[0m
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Write 'yes' or 'no'ESC[0m
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Write 'yes' or 'no'ESC[0m
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Write 'yes' or 'no'ESC[0m
ESC[0;32m    vmware-iso.autogenerated_1 (vsphere): Write 'yes' or 'no'ESC[0m

...forever

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions