4

I have added local box link in Vagrant file as follows

config.vm.box = "ubuntu1404"
config.vm.box_url = "http://localserver/ubuntu_trusty64.box"

My local server may not be accessible all time. I need to add another box URL for the same box which should accessible from everywhere as fail safe. How can I add another box url ?

1 Answers1

4

How can I add another box url ?

From vagrant documentation

config.vm.box_url - The URL that the configured box can be found at. If config.vm.box is a shorthand to a box in HashiCorp's Atlas then this value doesn't need to be specified. Otherwise, it should point to the proper place where the box can be found if it isn't installed.

This can also be an array of multiple URLs. The URLs will be tried in order. Note that any client certificates, insecure download settings, and so on will apply to all URLs in this list.

The URLs can also be local files by using the file:// scheme. For example: "file:///tmp/test.box".

so you could have

config.vm.box_url = ["http://localserver/ubuntu_trusty64.box", "http://anotherserver/ubuntu_trusty64.box", "file://somelocationtobox"]

One thing to add: this is important the very first time you run vagrant up with this box, as Vagrant will download and install the box (it will be stored under ~/.vagrant.d/boxes directory). Once it has been downloaded, in many cases Vagrant will not re-download the box even if you have destroyed the VM; you can read about config.vm.box_check_update for cases where Vagrant will try to re-download

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139