hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.11k stars 3.33k forks source link

Templating for floppy_files and cd_files #11210

Closed ekristen closed 2 years ago

ekristen commented 3 years ago

Community Note

Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request. If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

Please add templating for floppy_files and cd_files, or add an additional option to provide templated files using templatefile

This is being opened because https://github.com/hashicorp/packer/issues/4530 was closed.

Use Case(s)

The only way to provide windows with an Autounattend.xml is via floppy/usb/cd and there are a number of reasons why the Autounattend.xml needs to be a template.

I'm sure there are other use cases where floppy/usb/cd files need to be templated.

Potential configuration

template_floppy_files = {
  "Autounattend.xml": templatefile("${path.root}/templates/Autunattend.xml", { product_key = var.product_key })
}

Potential References

puetzk commented 3 years ago

FYI: this is possible using http_content since https://github.com/hashicorp/packer-plugin-sdk/pull/43, and cd_content since https://github.com/hashicorp/packer-plugin-sdk/pull/61. So I think it's just floppies that still don't have a way.

ekristen commented 3 years ago

Oh interesting. I missed that about cd content. I knew http had it, so if floppy could get it we'd be set.

frippe75 commented 3 years ago

This is a much needed enhancement! At the moment doing search'n'replace to do this. But running Packer containerized pull from a git repo makes this cumbersome. Templating in general should be support even for scripts using cd_files. But that's another thread.

azr commented 3 years ago

Hey @frippe75 ! cd_content is here, and floppy_content almost (depending on which plugin you use). The SDK has been updated and plugins needs to add support for it. It has landed for vsphere. Please consider contributing if you are in a rush :).

bendem commented 3 years ago

This is the same as #10859 btw.

tenthirtyam commented 2 years ago

Works wonderfully for the vSphere plugin for http_content, cd_content, and floppy_content. Used heavily in https://github.com/vmware-samples/packer-examples-for-vsphere.

@azr - it seems to me that this issue should be closed and that the support for templates is dependent on the plugin - and that issues should be raised at the plugin's project repo instead.

Ryan Johnson Senior Staff Solutions Architect | Product Engineering @ VMware, Inc.

nywilken commented 2 years ago

Closing as this has been fixed in the latest release for the vSphere Packer plugin. For other plugins that don't have this functionality please open an enhancement request on plugin issue tracker.

github-actions[bot] commented 2 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.