summaryrefslogtreecommitdiff
path: root/Vagrantfile
blob: f30ea972f4e2f5c75fa0b6d0a8b8c61026e8d235 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

unless Vagrant.has_plugin?('vagrant-vbguest')
  system "vagrant plugin install vagrant-vbguest"
  puts "Restarting vagrant process..."
  exec "vagrant #{ARGV.join' '}"
end

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "debian/jessie64"
  config.vm.box_version = "= 8.2.1"

  config.vm.provision "shell", inline: "sudo /etc/init.d/vboxadd setup"
  config.vm.provision "shell", inline: "apt-get install -y puppet"

  config.vm.define "source", primary: true do |source|
    source.vm.provision "puppet" do |puppet|
      puppet.manifests_path = "provisioning/manifests"
      puppet.module_path    = "provisioning/modules"
      puppet.manifest_file  = "source.pp"
    end
  end

  config.vm.provision "shell", :inline => <<-SHELL
    apt-get update
    apt-get install -y puppet
  SHELL

  for plugin in ['vagrant-vbguest']
    unless Vagrant.has_plugin?(plugin)
      puts "Missing plugin #{plugin}, installing..."
      `vagrant plugin install #{plugin}`
    end
  end

  config.vm.define "deb", autostart: false do |deb|
    deb.vm.provision "puppet" do |puppet|
      puppet.manifests_path = "provisioning/manifests"
      puppet.module_path    = "provisioning/modules"
      puppet.manifest_file  = "deb.pp"
    end
  end

  if /mswin|mingw/ =~ RUBY_PLATFORM
    config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/"
  end

  config.vm.provider "libvirt" do |v, override|
    v.memory = 1024
    override.vm.network :forwarded_port, guest: 3333, guest_ip: '127.0.0.1', host: 3333
  end

  config.vm.provider "virtualbox" do |v, override|
    v.memory = 1024
    override.vm.network :forwarded_port, guest: 3333, host: 3333 # do NOT add host_ip in this line. It is not necessary
  end
end