I'm using the excellent JClouds-Chef library to bootstrap and configure VMs with Chef.
I need to account for the use case where something goes wrong after JClouds-Chef has been executed on the VM, that allows me to basically rollback and uninstall it. The goal here is to leave the system in the same state it was originally in (before JClouds-Chef got involved) if something goes awry.
/tmp/chef-bootstrap.sh
file on the VMchef-bootstrap.sh
could be run over and over again, and each time it runs, simply reconfigure the Chef Client to use whatever are the latest recipes/roles/environments that the VM should have.So my first question is, is #3 above the case? If not, then how could I implement solutions #1 or #2, or is there a better way to go about this undo/revert/rollback functionality?
As far as I know Chef does not provide that rollback out of the box.
Regarding your questions:
The latest is the recommended and you could do it by:
When using the Chef client periodically, it is extremely important that all recipes you use are idempotent so they can be run many times without failing (by definition they should!).