#
#  Licensed to the Apache Software Foundation (ASF) under one or more
#  contributor license agreements.  See the NOTICE file distributed with
#  this work for additional information regarding copyright ownership.
#  The ASF licenses this file to You under the Apache License, Version 2.0
#  (the "License"); you may not use this file except in compliance with
#  the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#

Vagrant.configure("2") do |config|

  # enable hostmanager
  config.hostmanager.enabled = true
  config.hostmanager.manage_host = true

  #
  # source
  #
  config.vm.define "source" do |node|

    # host settings
    node.vm.hostname = "source"
    node.vm.box = "bento/centos-7.1"
    node.ssh.insert_key = "true"
    node.vm.network :private_network, ip: "192.168.33.10", netmask: "255.255.255.0"

    # provider
    node.vm.provider "virtualbox" do |vb|
      vb.memory = 1024
      vb.cpus = 1
    end
  end

  #
  # sink
  #
  config.vm.define "sink" do |node|

    # host settings
    node.vm.hostname = "sink"
    node.vm.box = "bento/centos-7.1"
    node.ssh.insert_key = "true"
    node.vm.network :private_network, ip: "192.168.33.11", netmask: "255.255.255.0"

    # provider
    node.vm.provider "virtualbox" do |vb|
      vb.memory = 4096
      vb.cpus = 3

      # network adapter settings; [Am79C970A|Am79C973|82540EM|82543GC|82545EM|virtio]
      vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
      vb.customize ["modifyvm", :id, "--nictype2","82545EM"]
      # disable audio, so that the vm doesn't capture the sound / mic
      vb.customize ["modifyvm", :id, "--audio", "none"]
    end

    # provision host
    node.vm.provision :ansible do |ansible|
      ansible.limit = "all"
      ansible.playbook = "../playbook.yml"
      ansible.extra_vars = "vars/main.yml"
    end
  end


end
