1

Lets say I have a box defined in vagrant, what would be the way to scale that box horizontally? The thing I have in mind is Azure VM Scale Set, where you just tell it to add a VM and it adds another VM just like the others.

4c74356b41
  • 69,186
  • 6
  • 100
  • 141

1 Answers1

1

Vagrant does not have this possibility - It creates a VM, if you want to 'scale' you need to create a 2nd machine from your Vagranfile

Vagrantfile is a ruby script .. you can put this number as arguments to command line (check https://stackoverflow.com/a/33084236/4296747) and then pass that in a loop to create multiple VMs

If you use docker, docker-compose has a nice scale option but its not there yet for Vagrant

Community
  • 1
  • 1
Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
  • so, i would need a script that would go and do vagrant up a bunch of times, each in a new dir? or something like that, and probably alter the vagrantfile a bit? – 4c74356b41 Mar 23 '17 at 15:42
  • 1 Vagrantfile can manage multiple VM - as Vagrantfile is a ruby script you can create loop to create multiple VM. vagrant up can start all or you can name which VM to startup. check [vagrant multiple machine](https://www.vagrantup.com/docs/multi-machine/) and you will find tons of example on internet – Frederic Henri Mar 23 '17 at 15:45
  • if all your VM are provisioning the same way, you will boot multiple machines with same config (different IP though) - as I said an easy scale option is not available in vagrant, you need to do it yourself in the Vagrantfile – Frederic Henri Mar 23 '17 at 15:57
  • 1
    Vagrantfile is a ruby script .. you can put this number as arguments to command line (check http://stackoverflow.com/a/33084236/4296747) and then pass that in a loop to create multiple VMs – Frederic Henri Mar 23 '17 at 16:08