bento icon indicating copy to clipboard operation
bento copied to clipboard

vSphere support additions, with shell environment variables?

Open boldandbusted opened this issue 3 years ago • 1 comments

Describe the Enhancement:

I've forked chef/bento to add locally-needed vSphere additions to create Vagrant Templates, as well as more 'generic' VM templates. I really like using shell environment variables to pass information into Packer, so I added code to:

  • Use the builder vshpere-iso to build on vSphere - and adding vSphere-related environment variables to set parameters and pass authentication inforamtion, or
  • Use the builder vmware-iso and upload with the vsphere and vsphere-template post-processors, also using the model of vSphere-related environment variables as in vsphere-iso.
  • Skeleton files to source in a POSIX shell before running packer --only=vsphere-iso <packer json file>
  • Handle VPN'd situations where when building on vSphere, one cannot route requests back to the host running Packer for HTTP preseed or kickstart files - using floppy_files and the recently-added cd_files instead.

I have endeavored to make the minimum amount of changes to the existing Bento code. For example, to create the vsphere-iso code, I copypasta'd the vmware-iso code, adding only enough to make the code 'work' with vSphere.

It might make sense to 'isolate' vsphere Packer JSON files from ther other builders because otherwise the naive case of running packer build <packer json file> will not work unless there's a working vSphere setup present - but I don't see precedent for that in Bento today. Would love ideas about this to for better 'separation of concerns'.

Describe the Need:

Users who use vSphere might like this code. :) Also, I created 'troubleshooter' Packer JSON files to allow the 'artifice' post-processor to upload artifacts to vSphere without rebuilding them, when using the wmware-iso builder and dealing with flakiness in vSphere or misconfigurations on my part...

I do understand, though, that future maintainability of this vSphere code is shaky, due to its proprietary nature. I can't promise that I'll always have access to vSphere to maintain and enhance this code.

Current Alternative

Other than writing my own Packer JSON to do this, I loved that I could easily make use of Bento's collected wisdom and hard-won experience. While there are other projects out there, none I could find had the breadth and depth of Bento for building OS images reliably, along with a strong community keeping code fresh.

Can We Help You Implement This?:

Let me know if this is even worthy of working towards a PR. I'm happy to clean the code up to your standards, and make it conform to Bento's (and Chef's) code-philosophies. I'm not sure that you-all will like the addition of 'skeleton' shell scripts to populate the vSphere Packer variables, so a preliminary thumbs-up/thumbs-down and advice for a PR is welcome.

Be aware, though, that I've not yet populated this across all OSes in Bento in my local fork. Right now, I've got working code for:

  • Ubuntu 18.04
  • Centos 7.9 (Couldn't get 7.8 to work, due to missing base ISOs...)
  • Windows 2019

You can get a sneak peak at the WIP here: https://github.com/AHEAD-Labs/bento/tree/jesse-AHEAD-vsphereization

Cheers! And thanks for Bento! 💯 🔥 💯

boldandbusted avatar Dec 16 '20 18:12 boldandbusted

Would love this. Also would like to maybe add pvscsi support in vsphere-iso. I have the code if needed.

loister72 avatar Jan 17 '21 19:01 loister72

Closing this issue due to age. Please feel free to re-open or submit a new issue if the problem still exists with the latest version of the bento code.

Stromweld avatar Jan 20 '23 16:01 Stromweld