chef-provisioning
chef-provisioning copied to clipboard
Expose new :from_machine attribute on machine_image
@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?
An update - cwebber was able to do this by monkey patching the allocate_image
method to not call machine.action_destroy
Lets go with from_machine
\cc @ryancragun could leverage this from https://github.com/chef-partners/marketplace_image
In this case, machine_image
will converge by checking for the named AMI before trying to create it.
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.