packer 可以使用 vsphere 模板并扩展它吗

Can packer use a vsphere template and extend it

我在 vsphere 的加壳器中构建了几个图像。您可以将这些视为基本映像,例如基本 linux 和基本 windows,它们安装了最少的必需软件。然后我想要额外的图像,这些图像将从基本模板构建并安装额外的服务,例如

这在打包机中可能吗?我可以使用模板名称作为源,而不必从 ISo 重新构建并安装所有最小的软件依赖项。

您可以为此使用 vsphere-clone 生成器。在您的基础构建生成 VSphere 模板后,您可以使用该输出工件作为子 Packer 模板构建的源:

source "vsphere-clone" "this" {
  communicator        = "none"
  host                = "esxi-1.vsphere65.test"
  insecure_connection = "true"
  password            = "jetbrains"
  template            = "alpine" # output base build template specified here
  username            = "root"
  vcenter_server      = "vcenter.vsphere65.test"
  vm_name             = "alpine-clone-${local.timestamp}"
}