# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"

require "vagrant"

if Vagrant::VERSION < "1.5.0"
  raise "py-junos-eznc requires Vagrant 1.5.x or higher"
end

builders = [
  { name: "ubuntu-12.04",
    box: "ubuntu-12.04",    
	url: "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box",
	script: "ubuntu.sh",
    ssh_port: 2001 },
  { name: "ubuntu-12.10",
    box: "ubuntu-12.10",    
	url: "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.10_chef-provisionerless.box",
	script: "ubuntu.sh",
    ssh_port: 2002 },		
  { name: "ubuntu-13.10",
    box: "ubuntu-13.10",    
	url: "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-13.10_chef-provisionerless.box",
	script: "ubuntu.sh",
    ssh_port: 2003 },	
  { name: "fedora-19",
    box: "fedora-19",    
	url: "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_fedora-19_chef-provisionerless.box",
	script: "fedora-19.sh",
    ssh_port: 2004 },	
  { name: "fedora-20",
    box: "fedora-20",    
	url: "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_fedora-20_chef-provisionerless.box",
	script: "fedora-20.sh",
    ssh_port: 2005 },
  { name: "centos-6.5",
    box: "centos-6.5",    
	url: "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box",
	script: "centos_6_x.sh",
    ssh_port: 2006 },	
  { name: "debian-7.4",
    box: "debian-7.4",    
	url: "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.4_chef-provisionerless.box",
	script: "debian.sh",
    ssh_port: 2007 },
  { name: "freebsd-9.2",
    box: "freebsd-9.2",    
	url: "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_freebsd-9.2_chef-provisionerless.box",
	script: "freebsd.sh",
    ssh_port: 2008 },
]


Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  builders.each do |opts|
    config.vm.define opts[:name] do |config|
      config.vm.box = opts[:box]
      config.vm.box_url = opts[:url]
      config.vm.boot_timeout = 120
	  config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", disabled: true
	  config.vm.network :forwarded_port, guest: 22, host: opts[:ssh_port], auto_correct: true
	  config.ssh.port = opts[:ssh_port]
	  # use sh to support FreeBSD
	  config.ssh.shell = "sh"
	  # use rsync for the synced folder to support FreeBSD	  
	  config.vm.synced_folder ".", "/vagrant", type: "rsync"
	  config.vm.provision :shell, :path => opts[:script]
	  config.vm.provision :puppet, :module_path => "modules", :options => "--debug", :synced_folder_type => "rsync"
    end
    config.vm.provider :virtualbox do |vb|
      vb.customize ["modifyvm", :id, "--memory", "1024"]
      vb.customize ["modifyvm", :id, "--cpus", "1"] 
    end
  end   

end
