I've been working on something similar, but to deploy on either physical blades or on top of VMware vCenter VMs in-house. I've been able to get this to work, but it's much slower when running hypervisor on hypervisor than hypervisor on physical hardware.
So, even if you are able to get this to work, you might find it's so slow it's not something you can really use in a CI pipeline where there's some expectation of quick results.
Alvaro above suggested using two pipelines:
2. scripts
3. VirtualBox
AWS:
1. ami (original)
2. scripts
3. aws (new ami)
I'm trying to do something similar, but there's a little more setup:
Phase 1: Create initial internal ami-equivalent base boxes (very static once created)
1. iso
2. kickstart + scripts which replicate existing AWS AMIs you would start with as exactly as possible
3. VMware/VirtualBox Vagrant base box which is equivalent (same RPMs, same initial config) to the AMI you will start with below.
4. we're planning on uploading these into vCenter as VM templates, also looked into creating them as OpenStack images.
Now we have the same behavior across:
1. Chef test-kitchen (or equivalent) when starting with vagrant base boxes on our mirror
2. Chef runs (or equivalent) or additional packer builds intended for vCenter deployment
3. Chef runs (or equivalent) or additional packer builds intended for AWS deployment
Phase 2: In-House CI deployment pipeline:
1. Vagrant base box which is equivalent to AMI in AWS pipeline (out of phase 1)
2. scripts / cookbooks
3. customized base box
4. new template uploaded into vCenter
5. VMs created from template, at some point via VCAC automation
Phase 2: AWS CI deployment pipeline:
1. ami which is equivalent to Vagrant base box in In-House pipeline
2. scripts / cookbooks
3. customized ami
4. new instances created from AMI via CloudFormation
Still working through the implementation of this, but that's the approach...
Comments appreciated!
Mike