I have a Vagrant file that I want to use to launch 3 VMs on three separate hosts. If I run
vagrant up master
vagrant up slave1
vagrant up slave2
things work as expected; I get my three VMs running on three different hosts.
However, if I just run
vagrant up
I end up with all the machines on one host. There are similar issues with vagrant destroy.
Am I doing something wrong? Is there a flag I need to set?
My setup:
- I'm running vagrant from a Ubuntu 14.04LTS desktop.
- provider = libvirt
- I used vagrant-mutate to make the box libvirt compatible
- vagrant version 1.7.4
- VAGRANT_DEFAULT_PROVIDER=libvirt is set in my .bashrc
Hosts:
- Ubuntu Server 14.04LTS
I can expand on this if necessary, but it seems like the problem is something I'm doing in vagrant; somehow it's only using the .provider section once???
Vagrantfile:
# -x- mode: ruby -x-
# vi: set ft=ruby :
boxes = [
{
:name => "master",
:host => "192.168.1.21",
:hostname => "hibanako-1",
:mac => "..."
},
{
:name => "slave1",
:host => "192.168.1.22",
:hostname => "hibanako-2",
:mac => "..."
},
{
:name => "slave2",
:host => "192.168.1.23",
:hostname => "hibanako-3",
:mac => "..."
}
]
VAGRANT_API_VERSION = "2"
Vagrant.configure(VAGRANT_API_VERSION) do |config|
boxes.each do |opts|
config.vm.define opts[:name] do |boxconfig|
boxconfig.vm.box = "ubuntu/trusty64"
boxconfig.vm.hostname = opts[:hostname]
boxconfig.vm.network :public_network,
:dev => "p2p1",
:mac => opts[:mac],
:mode => 'bridge'
boxconfig.vm.provider :libvirt do |lv|
lv.host = opts[:host]
lv.username = "..."
lv.connect_via_ssh = true
lv.memory = 1600
lv.cpus = 4
end
end
end
end
Some of the resources I've looked at:
- https://ttboj.wordpress.com/2014/05/13/vagrant-on-fedora-with-libvirt-reprise/
- How to "vagrant up" multiple nodes at a time?
- Vagrantfile with multiple vm and providers
- Vagrant VMs on Multiple Physical Machines
- https://liquidat.wordpress.com/2014/03/03/howto-vagrant-libvirt-multi-multi-machine-ansible-and-puppet/
- http://www.lucainvernizzi.net/blog/2014/12/03/vagrant-and-libvirt-kvm-qemu-setting-up-boxes-the-easy-way/
- (I'm sure there are others ...)