Building more complex lab with Vagrant

You can easily setup a bigger environment with a number of virtual machines using Vagrant. This helps if you want to test various more complex scenarios (high-availabilities, failures, replications, etc.) locally.

Once you're done with you virtual machine setup, package your Vagrant box:

vagrant package --output

Then, you can add your packaged box to the vagrant:

vagrant box add --name centos

Just to double-check if the box has been added to vagrant, list all added boxes:

vagrant box list

Edit Vagrant file to add the following lines (this configuration is for 3 replicated servers):

def config_centos(config, node_number)
config.vm.define "zipset#{node_number}" do |replica| = "centos"
    replica.vm.hostname = "centos#{node_number}" "private_network", ip: "{node_number}"

    for node_number in 1..3
        config_centos config, node_number

Now we can start all three servers at once with the following Vagrant command:

vagrant up /centos*/

You can check all of your Vagrant machines statuses with vagrant global-status command.