I'm using packer with a vmware-iso source and an ansible provisioner. As I'm tinkering with ansible to get things working, I end up running packer from the beginning which starts from the iso from scratch (e.g. downloading centos updates, etc).
I know I can disable the ansible provisioner (manually comment out the provisioner section on the packer hcl file), store the result of vmware-iso build somewhere and manually start a virtual machine from that, then make all the ansible tests there, but I'm wondering if there is a better / automatic way to do this, similarly to how docker caches layers and uses a cache to avoid redoing work unnecessarily.
Is there any way to do this? perhaps I can have intermediate builders and tell packer which stage of the building to execute? e.g.
- build1: from iso produces ova.
- build2: from result of build1 runs ansible provisioner and produces another ova
this way I can tell packer whether to build from scratch or from build2 only.
any ideas?