How to test VM provisioning script without provisioning Currently I'm on a state that testing costs me money and a lot of time...

Background: I'm deploying VMs at softlayer and using a post-deployment script(bash) that will install every software that I need after the VM is ready.
The problem is, I can only test this script by deploying one VM, and it's currently taking around 4h for the script to finish... So every change that I make I need to create a new VM(costs money) and wait for around 4 hours to see if the script is broken or not... This is becoming chaotic and I won't be able to move forward if I stay this way.

I need a new way to approach this kind of situation and be able to test the provisioning script more quickly and without needing to deploy a new VM every time.

Do you guys know some tool to help me on this scenario ?
I can see some options:


Use Vagrant to create your VMs; it separates the process of creating the VM (including the base OS) and the actual provisioning. It also has some options to run certain provisioning steps at certain circumstances only.
Use Ansible, Puppet or something like that to switch to a provisioning mode where you do not do the same stuff everytime, but only what is needed. This means that you can start the job, and at the first failed part, stop. Fix that part, then continue.
Use Docker. This is slightly different than the Vagrant/Ansible approach in that it creates containers (which you don't actually need, as far as I can tell). It has the benefit, beyond the Ansible approach, that it gives you a very fine grained step-by-step development process. I.e., if one step fails, you still have all the images leading up to that, so during development, with a bit of discipline, you become very, very fast indeed.


All of these tools do much more than what you need, but all of them give you a way to do your job incrementally. Vagrant, Ansible and Docker are pretty easy to learn, as far as I'm concerned (as long as you are in Dev/Test mode, the "interesting" parts start when you go to production). Ansible is very minimalistic and needs nothing except a ssh connection. Vagrant and Docker might not be feasible in your infrastructure, you will quickly see.