summaryrefslogtreecommitdiff
path: root/spec/one_node/Vagrantfile
blob: 03b9ff7d90855ac484ddbb630f3d64db4686d9fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'yaml'

configs = YAML.load_file("config.yaml")

Vagrant.configure("2") do |config|
  config.vm.provider :libvirt do |libvirt|
    libvirt.cpu_mode = 'host-passthrough'
  end
  configs.keys.each do |host|
    config.vm.define host.to_sym do |c|
      c.vm.box = "higebu/vyos"
      c.vm.synced_folder "./", "/vagrant",
        :owner => "vagrant",
        :group => "vyattacfg",
        :mount_options => ["dmode=775,fmode=775"]
      c.vm.hostname = host
      if !configs[host].nil? and configs[host].has_key? :networks
        configs[host][:networks].keys.each do |net|
          c.vm.network :private_network,
            :ip => configs[host][:networks][net],
            :libvirt__network_name => net,
            :libvirt__dhcp_enabled => false
        end
      end
      c.vm.provision "shell", path: "#{host}_script.sh"
    end
  end
end