Sha256: 8fcf7db5a69ef3a1ffc4d92bcd807f90d826fe2c33bf4a0e68b31164cc0b19fa

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "ubuntu/precise64"
  config.omnibus.chef_version = :latest

  config.vm.network :private_network, ip: "10.11.12.14"

  #config.vm.network "forwarded_port", guest: 80, host: 9292

  abbr_name = "#{ENV['VNAME'].gsub('dev-', '')}"
  name = "#{abbr_name}-perkins"

  config.vm.hostname = name

  config.vm.provider "virtualbox" do |v|

    host = RbConfig::CONFIG['host_os']

    # Give VM 1/4 system memory & access to all cpu cores on the host
    if host =~ /darwin/
      cpus = `sysctl -n hw.ncpu`.to_i
      # sysctl returns Bytes and we need to convert to MB
      mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
    elsif host =~ /linux/
      cpus = `nproc`.to_i
      # meminfo shows KB and we need to convert to MB
      mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
    else # sorry Windows folks, I can't help you
      cpus = 2
      mem = 1024
    end
    v.customize ["modifyvm", :id, "--ioapic", "on"]
    v.customize ["modifyvm", :id, "--memory", mem]
    v.customize ["modifyvm", :id, "--cpus", cpus]
    v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
  end

  config.vm.synced_folder "./", "/vagrant", :nfs => true

  config.vm.provision "chef_client" do |chef|
    chef.chef_server_url = "https://chef.preyapp.com"
    chef.node_name = name
    chef.validation_key_path = ENV['VPATH']
    chef.validation_client_name = abbr_name
    chef.environment = "development"

    # Run list
    chef.add_role "development"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
perkins-0.0.5 Vagrantfile
perkins-0.0.3 Vagrantfile
perkins-0.0.2 Vagrantfile