-
Notifications
You must be signed in to change notification settings - Fork 3.3k
vsphere-iso builder: Better support for removing ethernet before export #10029
Description
Description
When I use the normal export capabilities from the vsphere-iso builder without removing the ethernet card, the ovf expects the network capabilities to be available wherever the vmdk is imported. This results in an error like this (using govc in this example).
govc: Host did not have any virtual network defined.
To mitigate this, we've added some manual overrides to the shutdown process before the export occurs, but it feels very hacky:
{
"builders": [
{
"type": "vsphere-iso",
"disable_shutdown": true
,
}],
"provisioners": [
{
"expect_disconnect": true,
"inline": [
"echo '{{user `user`}}' | sudo -S shutdown -h +1"
],
"only": [
"vsphere-iso"
],
"type": "shell"
},
{
"command": "govc device.remove -k -u '{{ user `user` }}:{{ user `pass` }}@{{ user `host` }}' -vm '{{ user `template` }}' ethernet-0",
"only": [
"vsphere-iso"
],
"type": "shell-local"
}]
}Another odd nuance is that when using the "disable_shutdown": true, the export from vsphere-iso spits out a vmdk named like template_name-disk-0.vmdk otherwise it's just named disk-0.vmdk, not sure why that is.
Use Case(s)
The primary use-case I see is being able to ship my exported template to vcenters different from the one the template was generated on.
Versions
Packer v1.6.1
govc 0.23.0