Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vsphere-iso: Add support for removing ethernet before export #6

Closed
ghost opened this issue Apr 15, 2021 · 4 comments · Fixed by #415
Closed

vsphere-iso: Add support for removing ethernet before export #6

ghost opened this issue Apr 15, 2021 · 4 comments · Fixed by #415
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Apr 15, 2021

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

@usscarter
Copy link

I also just encountered a situation for this that would be an addition.

In my case I actually want to leave the NIC, but I want to swap it over to a different port-group. We have a system that requires the vlan to be set in the template already, and this creates issues.

@jaymzmac
Copy link

I would also like to see this feature of removing the network adapter after building the template and prior to uploading to a content library.

hmalphettes pushed a commit to hmalphettes/packer-plugin-vsphere that referenced this issue May 7, 2022
@aronwk-aaron
Copy link

aronwk-aaron commented Jun 6, 2022

Original Comment:

Bumping because this is a huge need when making templates

Edit:
This is a necessity when making templates since the template that is created is rarely going to be used on the network that it was built on. So we end up having people taking up our network space and blocking other things from working, which causes a lot of issues with automation. Please consider raising the priority of this issue since it would be a major QoL improvement.

@tenthirtyam
Copy link
Collaborator

Hi @aronwk-aaron, et al

  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions, these generate noise for maintainers and watchers.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and follow the contributing guidelines.

Ryan Johnson
Staff II Solutions Architect | VMware, Inc.

@tenthirtyam tenthirtyam changed the title vsphere-iso builder: Better support for removing ethernet before export vsphere-iso: Add support for removing ethernet before export Nov 5, 2022
@tenthirtyam tenthirtyam self-assigned this Mar 5, 2024
@tenthirtyam tenthirtyam added this to the Backlog milestone Apr 17, 2024
tenthirtyam added a commit that referenced this issue Apr 27, 2024
Adds the option to remove all network adapters at the end of the image build.

Ref: #6

Signed-off-by: Ryan Johnson <[email protected]>
tenthirtyam added a commit that referenced this issue Apr 27, 2024
Adds the option to remove all network adapters at the end of the image build.

Ref: #6

Signed-off-by: Ryan Johnson <[email protected]>
tenthirtyam added a commit that referenced this issue Apr 27, 2024
Adds the option to remove all network adapters at the end of the image build.

Ref: #6

Signed-off-by: Ryan Johnson <[email protected]>
tenthirtyam added a commit that referenced this issue Apr 27, 2024
Adds the option to remove all network adapters at the end of the image build.

Ref: #6

Signed-off-by: Ryan Johnson <[email protected]>
tenthirtyam added a commit that referenced this issue Apr 27, 2024
Adds the option to remove all network adapters at the end of the image build.

Ref: #6

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam tenthirtyam modified the milestones: Backlog, v1.3.0 May 1, 2024
tenthirtyam added a commit that referenced this issue May 9, 2024
Adds the option to remove all network adapters at the end of the image build.

Ref: #6

Signed-off-by: Ryan Johnson <[email protected]>
tenthirtyam added a commit that referenced this issue May 9, 2024
Adds the option to remove all network adapters at the end of the image build.

Ref: #6

Signed-off-by: Ryan Johnson <[email protected]>
lbajolet-hashicorp pushed a commit that referenced this issue May 9, 2024
Adds the option to remove all network adapters at the end of the image build.

Ref: #6

Signed-off-by: Ryan Johnson <[email protected]>
@hashicorp hashicorp locked and limited conversation to collaborators Jun 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants