boxcutter / ubuntu

Virtual machine templates for Ubuntu written in legacy JSON
Apache License 2.0
736 stars 375 forks source link

Make keep_input_artifact value a variable #87

Open ferrarimarco opened 7 years ago

ferrarimarco commented 7 years ago

Hi all. I would like to use these packer templates as a base for other images. This could be achieved by setting the keep_input_artifact configuration value in a variable with the default value of false. With this change, a user of this template could:

  1. Set the value of that variable to true
  2. Feed the artifacts to other builders in another template to iterate over them, mainly to perform additional provisioning

I can provide a pull request for this, thanks.

annawake commented 7 years ago

What do you think you would be provisioning additionally?

The intent is that these are "JEOS boxes" (Just Enough OS...for a configuration management system). There really shouldn't be much more that should be done in another template besides calling a CM system to do the rest of the work, like Chef, Ansible, Puppet or Saltstack. What do you have in mind?

That being said, we've had issues with packer not supporting boolean values as variables (basically anything that is not a string. Have you tested this to make sure it's even possible with the latest packer? As I recall it packer won't accept this value as a string and it might not be able to parametize like you are thinking.

ferrarimarco commented 7 years ago

I am using the ubuntu 16.04 boxcutter box as a base for a couple of other vagrant boxes (this is the latest one, open-development-environment-devbox). I would like to avoid the provisioning phase each time I destroy my boxes.

According to mitchellh/packer#1913 it should work (it was the very same use case BTW). There is also a possible regression in mitchellh/packer#2630 I am testing it now with the latest packer (0.12.0) and let you know.

Edit ( @annawake ): it did not work. I am providing information in mitchellh/packer#2630

ferrarimarco commented 7 years ago

@annawake Appartently a fix for this issue is low on the Packer devs list of priorities

Is it possible to set this flag to true in this repository? Anyway keeping the input artifact allows to pipe the output of your build to another Packer build.