Vsphere-iso content library iso path

Sorry if this is a silly question. I am very new to packer, trying to learn it.

I have been trying to build an image using an iso from a content library, but can’t find any documentation about how to use the content library. I am using the variable files from efops (GitHub - efops/packer-ubuntu20.04: Packer vsphere-iso builder for Ubuntu-20.04)

This is what I am trying to use as the iso_path:
iso_path = “contentlib/content-lib/ubuntu-server-22.04”

this is whaqt govc shows
govc library.ls content-lib/ubuntu-server-22.04/*

/content-lib/ubuntu-server-22.04/ubuntu-22.04-live-server-amd64.iso

the build can connect, creates the VM, says it’s adding the cdrom which it does, but when I look at the mount it’s using a datastore instead of the content library so it doesn’t find and boot from the iso.

Here is the log output:
2022/06/08 11:47:52 packer-builder-vsphere-iso plugin: Check if ISO path is a Content Library path
2022/06/08 11:47:53 packer-builder-vsphere-iso plugin: ISO path not identified as a Content Library path
2022/06/08 11:47:53 packer-builder-vsphere-iso plugin: Using [QNAP-HDD-Cluster] /contentlib/content-lib/-serv
er-22.04/-20.04.1-live-server-amd64.iso as the datastore path

Thank you.

UPDATE:
so after playing around with the paths for a bit, I was able to get it to identify the path as a content library. Seems the trick was to start the iso_path with the library name.

However, even though it found the library, it’s not seeing the ISO inside the library. It’s saying it can’t find the datastore ID path.

2022/06/08 12:37:32 packer-builder-vsphere-iso plugin: Check if ISO path is a Content Library path
2022/06/08 12:37:33 packer-builder-vsphere-iso plugin: ISO path identified as a Content Library path
2022/06/08 12:37:33 packer-builder-vsphere-iso plugin: Finding the equivalent datastore path for the Content Library ISO
file path
2022/06/08 12:37:33 packer-builder-vsphere-iso plugin: [WARN] Couldn’t find datastore ID path for -20.04.1-li
ve-server-amd64.iso
2022/06/08 12:37:33 packer-builder-vsphere-iso plugin: Using [QNAP-HDD-Cluster] //content-lib/-server-22.04/<
sensitive>-20.04.1-live-server-amd64.iso as the datastore path
2022/06/08 12:37:33 packer-builder-vsphere-iso plugin: Creating CD-ROM on controller ‘&{{{} 15000 0xc000e8b4a0 100 0xc00134476c} 0 }’ with iso ‘[QNAP-HDD-Cluster] //content-lib/-server-22.04/-20.04.
1-live-server-amd64.iso’

I don’t believe it’s a permissions issue, I am using an admin account for now just to get it working. I can see the library, the file, and the datastore info with govc commands.

Any help would be appreciated!

I’m not sure if this is of any relevance to you anymore, if not, maybe someone else comes across it. iso_paths (plural!) requires a list of items. The weird thing is that the datastore itself needs square brackets, which in turn are placed within square brackets (because it’s a list). I got the full path simply by manually adding the iso to a random virtual machine and looking in the VM settings. So in my case, this is the result:

  iso_paths             = [
                        "[vmstorage] iso/ubuntu-22.04.1-live-server-amd64.iso"
                        ]
1 Like