dev/Vagrantfile
changeset 609 736fdedb7774
parent 590 e103299bccc0
child 610 dc75c8d65289
equal deleted inserted replaced
608:047aab3a53cf 609:736fdedb7774
     1 # -*- mode: ruby -*-
     1 # -*- mode: ruby -*-
     2 # vi: set ft=ruby :
     2 # vi: set ft=ruby :
     3 
     3 
       
     4 require 'yaml'
       
     5 
       
     6 custom_file_path = File.join(__dir__, 'custom.yaml')
       
     7 
       
     8 context = File.exist?(custom_file_path)?YAML::load_file(custom_file_path):{}
       
     9 
       
    10 ROOT_PATH = context.fetch("root_path","../")
     4 
    11 
     5 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
    12 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
     6 VAGRANTFILE_API_VERSION = "2"
    13 VAGRANTFILE_API_VERSION = "2"
     7 
    14 
     8 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    15 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    22   # accessing "localhost:8080" will access port 80 on the guest machine.
    29   # accessing "localhost:8080" will access port 80 on the guest machine.
    23   # config.vm.network :forwarded_port, guest: 80, host: 8080
    30   # config.vm.network :forwarded_port, guest: 80, host: 8080
    24 
    31 
    25   # Create a private network, which allows host-only access to the machine
    32   # Create a private network, which allows host-only access to the machine
    26   # using a specific IP.
    33   # using a specific IP.
    27   config.vm.network :private_network, ip: (ENV['VM_IP'] || "172.16.1.2")
    34   config.vm.network :private_network, ip: (ENV['VM_IP'] || context['vm_ip'] || "172.16.1.2")
    28 
    35 
    29   # Create a public network, which generally matched to bridged network.
    36   # Create a public network, which generally matched to bridged network.
    30   # Bridged networks make the machine appear as another physical device on
    37   # Bridged networks make the machine appear as another physical device on
    31   # your network.
    38   # your network.
    32   # config.vm.network :public_network
    39   # config.vm.network :public_network
    37 
    44 
    38   # Share an additional folder to the guest VM. The first argument is
    45   # Share an additional folder to the guest VM. The first argument is
    39   # the path on the host to the actual folder. The second argument is
    46   # the path on the host to the actual folder. The second argument is
    40   # the path on the guest to mount the folder. And the optional third
    47   # the path on the guest to mount the folder. And the optional third
    41   # argument is a set of non-required options.
    48   # argument is a set of non-required options.
    42   config.vm.synced_folder "../", "/srv/comt"
    49   config.vm.synced_folder ROOT_PATH, "/srv/comt"
    43 
    50 
    44   #vmname = "coment_dev_5311da30" #"coment_dev_"+Time.now.getutc.to_f.to_int.to_s(16)
    51   vmname = (ENV['VM_NAME'] || context['vm_name'] || "coment_dev")
    45   vmname = "coment_dev"
       
    46 
    52 
    47   config.vm.define :"#{vmname}" do |coment_dev|
    53   config.vm.define :"#{vmname}" do |coment_dev|
    48   end
    54   end
    49 
    55 
    50   # Provider-specific configuration so you can fine-tune various
    56   # Provider-specific configuration so you can fine-tune various
    84   config.vm.provision :puppet do |puppet|
    90   config.vm.provision :puppet do |puppet|
    85     puppet.manifests_path = "manifests"
    91     puppet.manifests_path = "manifests"
    86     puppet.manifest_file  = "site.pp"
    92     puppet.manifest_file  = "site.pp"
    87     puppet.module_path    = "modules"
    93     puppet.module_path    = "modules"
    88     puppet.options        = "--hiera_config /vagrant/hiera.yaml "
    94     puppet.options        = "--hiera_config /vagrant/hiera.yaml "
       
    95     puppet.facter = {
       
    96       "vagrant_base_path" => File.dirname(__FILE__)
       
    97     }
    89   #  puppet.options        = "--debug --verbose --hiera_config /vagrant/hiera.yaml "
    98   #  puppet.options        = "--debug --verbose --hiera_config /vagrant/hiera.yaml "
    90   end
    99   end
    91 
   100 
    92   # Enable provisioning with chef solo, specifying a cookbooks path, roles
   101   # Enable provisioning with chef solo, specifying a cookbooks path, roles
    93   # path, and data_bags path (all relative to this Vagrantfile), and adding
   102   # path, and data_bags path (all relative to this Vagrantfile), and adding