Packer no shutdown

I would like to use Packer for its ability to edit the boot command. Its brilliant. The setup I am performing however is just booting from iso and the rest is handled automatically. There is no shutdown and no other provisioning required.

I searched but I seem to find outdated info.

Is it possible to have Packer create a VM using vsphere-iso so I can use the boot command, then end the packer build without doing anything else?

Right now Packer waits for IP which it never gets.

Thanks.

Packer waits for an IP address because it anticipates provisioning. Setting a short timeout addresses this…

set a very short timeout for the IP address acquisition so it never waits long to acquire IP.

communicator = "none"
boot_wait = "5s"
builders {
  type = "iso"

  boot_command = "some boot commands"
  boot_wait = "5s"
  communicator = "none"
  shutdown_command = "none"

}
1 Like

Thanks for the quick reply :smiley:

Apologies for what is perhaps obvious stuff …

This is what I currently have:

packer {
  required_plugins {
    vsphere = {
      source  = "github.com/hashicorp/vsphere"
      version = "~> 1"
    }
  }
}

source "vsphere-iso" "test" {
  CPU_hot_plug         = true
  CPUs                 = 2
  RAM                  = 2048
  RAM_hot_plug         = true
  boot_command         = ["e<down><down><down><down><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><right><bs><bs><bs><bs><bs>vmware test.config=guestinfo net.ifnames=0 reboot=k text<f10>"]
  boot_wait            = "3s"
  cluster              = "pbc"
  convert_to_template  = false
  create_snapshot      = false
  datacenter           = "attic"
  datastore            = "nfs_ds"
  disk_controller_type = ["pvscsi"]
  folder               = "k8s"
  guest_os_type        = "other6xLinux64Guest"
  host                 = "esxi.domain.net"
  insecure_connection  = "true"
  iso_paths            = ["[nfs_ds] isos/233d9a0cbb35c256151626f357a64cc37d55552da09935bd82449f7660c64b45/metal-amd64.iso"]
  notes                = "Packer test version 0.0.8"
  communicator         = "none"
  shutdown_command     = "none"
  ssh_username         = "root"
  configuration_parameters = {
    "disk.EnableUUID" = "TRUE"
    "guestinfo.test.config" = "dmVyc2lvbjogdj......5lbnRzLnlhbWwK"
  }
  network_adapters {
    network = "lan"
    network_card = "vmxnet3"
  }
  storage {
    disk_size             = 100000
    disk_thin_provisioned = true
  }
  network_adapters {
    network = "storage"
    network_card = "vmxnet3"
  }
  storage {
    disk_size             = 500000
    disk_thin_provisioned = true
  }
  username       = "Administrator@vsphere.local"
  password         = "haha"
  vcenter_server = "vcenter.domain.net"
  vm_name        = "test"
}

build {
  sources = [ "vsphere-iso.test" ]
}

I get the key value pairs, but I don’t understand how I am to adapt to the builders type iso? How does that work exactly?

ps. I need 3s boot_wait because the boot grub timeout is really short and vmware boots really fast :smiley:

ps2.

  communicator         = "none"
  shutdown_command     = "none"

results in:

Warning: The parameter `shutdown_command` is ignored as it requires a `communicator`.

Thanks again! Really appreciate the help!