2

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:

Community
  • 1
  • 1
ajp619
  • 670
  • 7
  • 11
  • Just came across this link: https://github.com/vagrant-libvirt/vagrant-libvirt/issues/163 It appears this is a vagrant issue in that vagrant does not update provider information. – ajp619 Oct 20 '16 at 13:50

0 Answers0