-
Notifications
You must be signed in to change notification settings - Fork 108
vsphere-iso: Add support for removing ethernet before export #6
Description
This issue was originally opened by @johnjelinek as hashicorp/packer#10029. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.
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