# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# mock Scenario Vagrantfile

require 'yaml'
settings = YAML.load_file('genconfig/config.yml')

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

  config.vm.box = settings["vagrant_box"]

  # sync these folders with VM
  config.vm.synced_folder "../../../", "/opt/cord/", create: true
  config.vm.synced_folder "../../../../cord_profile/", "/opt/cord_profile/", create: true
  config.vm.synced_folder "../../platform-install/credentials/", "/opt/credentials/", create: true

  # set the headnode VM
  config.vm.define "head1" do |d|
    d.vm.hostname = "head1"
    d.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: '0.0.0.0'
    d.vm.network "private_network",
      ip: settings['head_vm_ip']
    d.vm.provider :virtualbox do |vb|
      vb.memory = settings['head_vm_mem']
      vb.cpus = settings['head_vm_cpu']
    end
    d.vm.provider :libvirt do |v, override|
      v.memory = settings['head_vm_mem']
      v.cpus = settings['head_vm_cpu']
      override.vm.synced_folder "../../../", "/opt/cord/", type: "nfs", nfs_udp: false, nfs_version: 4
      override.vm.synced_folder "../../../../cord_profile/", "/opt/cord_profile/", type: "nfs", nfs_udp: false, nfs_version: 4
      override.vm.synced_folder "../../platform-install/credentials/", "/opt/credentials/", type: "nfs", nfs_udp: false, nfs_version: 4
    end
  end

end

