chef-provisioning icon indicating copy to clipboard operation
chef-provisioning copied to clipboard

Expose new :from_machine attribute on machine_image

Open tyler-ball opened this issue 9 years ago • 5 comments

@cwebberOps has a use case where he has an existing machine that he wants to turn into a machine_image (EG, an ami in amazon land). This machine AMI needs to be pristine - IE, it needs to NOT have Chef installed on it.

This can be accomplished on a linux or windows machine by running a machine resource (to create the base machine and converge it) then using a machine_execute resource to uninstall Chef. The problem with this approach is that there is no way to tell machine_image to use the existing machine as the base to create the image.

This could also be accomplished by updating the machine_image resource with some pre_converge_execute and post_converge_execute hooks.

\cc @jkeiser what do you think?

tyler-ball avatar May 20 '15 00:05 tyler-ball

An update - cwebber was able to do this by monkey patching the allocate_image method to not call machine.action_destroy

tyler-ball avatar May 28 '15 20:05 tyler-ball

Lets go with from_machine

tyler-ball avatar May 28 '15 22:05 tyler-ball

\cc @ryancragun could leverage this from https://github.com/chef-partners/marketplace_image

tyler-ball avatar Jun 16 '15 17:06 tyler-ball

In this case, machine_image will converge by checking for the named AMI before trying to create it.

randomcamel avatar Jun 16 '15 17:06 randomcamel

There is an example of a hack that roughly does what this does is intended to do in the Corp Delivery instance.. CIA/training-images.

cwebberOps avatar Jun 16 '15 18:06 cwebberOps