dev/Vagrantfile
changeset 609 736fdedb7774
parent 590 e103299bccc0
child 610 dc75c8d65289
--- a/dev/Vagrantfile	Wed Mar 12 17:19:23 2014 +0100
+++ b/dev/Vagrantfile	Fri Mar 14 03:08:58 2014 +0100
@@ -1,6 +1,13 @@
 # -*- mode: ruby -*-
 # vi: set ft=ruby :
 
+require 'yaml'
+
+custom_file_path = File.join(__dir__, 'custom.yaml')
+
+context = File.exist?(custom_file_path)?YAML::load_file(custom_file_path):{}
+
+ROOT_PATH = context.fetch("root_path","../")
 
 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
 VAGRANTFILE_API_VERSION = "2"
@@ -24,7 +31,7 @@
 
   # Create a private network, which allows host-only access to the machine
   # using a specific IP.
-  config.vm.network :private_network, ip: (ENV['VM_IP'] || "172.16.1.2")
+  config.vm.network :private_network, ip: (ENV['VM_IP'] || context['vm_ip'] || "172.16.1.2")
 
   # Create a public network, which generally matched to bridged network.
   # Bridged networks make the machine appear as another physical device on
@@ -39,10 +46,9 @@
   # the path on the host to the actual folder. The second argument is
   # the path on the guest to mount the folder. And the optional third
   # argument is a set of non-required options.
-  config.vm.synced_folder "../", "/srv/comt"
+  config.vm.synced_folder ROOT_PATH, "/srv/comt"
 
-  #vmname = "coment_dev_5311da30" #"coment_dev_"+Time.now.getutc.to_f.to_int.to_s(16)
-  vmname = "coment_dev"
+  vmname = (ENV['VM_NAME'] || context['vm_name'] || "coment_dev")
 
   config.vm.define :"#{vmname}" do |coment_dev|
   end
@@ -86,6 +92,9 @@
     puppet.manifest_file  = "site.pp"
     puppet.module_path    = "modules"
     puppet.options        = "--hiera_config /vagrant/hiera.yaml "
+    puppet.facter = {
+      "vagrant_base_path" => File.dirname(__FILE__)
+    }
   #  puppet.options        = "--debug --verbose --hiera_config /vagrant/hiera.yaml "
   end