bento icon indicating copy to clipboard operation
bento copied to clipboard

Post processor hook

Open mrjcleaver opened this issue 9 years ago • 4 comments

I'd like a post-processor hook to call an optional script after completion

https://chefcommunity.slack.com/archives/general/p1472577941000023

I want to bootstrap a VM on ESXi that sets up DHCP, sets node name and includes chef’s bootstrap.

bento is about setting up a clean image for things like test-kitchen and chef/ansible/salt/shell to build on top of now you could modify/fork to do custom stuff but that is outside the scope of what bento is about cheeseplus [1:59 PM]
yea, the only thing we can do to make it a little easier is add an optional script so like you feed it an env var for optional script(s) boxcutter does that and it's the only thing we don't really have parity with

Better though - what’s the chance that this optional script would get added to Bento?

so the fact I've mentioned adding it means I'm up for it, just nobody has asked

mrjcleaver avatar Sep 08 '16 14:09 mrjcleaver

This hook and wrapper stuff is related to https://github.com/ianchesal/packer-config/issues/21 / https://github.com/aspring/racker/issues/10 - related projects for which I'm pushing to get documented on https://github.com/aspring/racker/issues/10

There's also opportunity and perhaps benefit to consolidate extensions in Packer-config, racker and this hook stuff for Bento.

mrjcleaver avatar Sep 08 '16 14:09 mrjcleaver

Go is a full fledged language, certainly, but Packer is JSON and not actually a DSL on top of Go so Packer templates themselves can't inherently be DRY like you'd like them to so you use generators

mrjcleaver avatar Sep 08 '16 15:09 mrjcleaver

I would highly appreciate the possibility of specifying a custom script like in boxcutter. Thanks for considering.

mgruner avatar Oct 20 '17 11:10 mgruner

What I've done to accomplish this is by using jq to append a json item to the provisioners. Something like the following will take the contents of your.json and append it to the list of provisioners.

$ jq --slurpfile item your.json '.provisioners += $item' /path/to/template.json >| /path/to/new/template.json

arizvisa avatar Oct 31 '19 21:10 arizvisa

Closing this due to age. Please feel free to check out the new HCL2 re-write and open a new feature request or PR.

Stromweld avatar Jan 20 '23 00:01 Stromweld