Skip to content

Instantly share code, notes, and snippets.

@PositiveControl
Created October 27, 2014 16:47
Show Gist options
  • Save PositiveControl/ae79a1da31894f9dc2d9 to your computer and use it in GitHub Desktop.
Save PositiveControl/ae79a1da31894f9dc2d9 to your computer and use it in GitHub Desktop.
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 require File.expand_path("../config.rb", __FILE__)
5
6 $username = ENV["USER"]
7
8 Vagrant.configure("2") do |config|
9 config.vm.box = "teamsnap/embryo"
10
11 config.vm.provision "chef_solo" do |chef|
12 chef.synced_folder_type = "nfs"
13 chef.add_recipe("devbox")
14
15 chef.json = {
16 :user => {
17 :username => $username,
18 :password => $password,
19 :email => $email,
20 :full_name => $full_name,
21 :vim_colorscheme => $vim_colorscheme,
22 :vim_background => $vim_background,
23 }
24 }
25 end
26
27 (3000..3005).each do |port|
28 config.vm.network :forwarded_port, :guest => port, :host => port
29 end
30 config.vm.network :forwarded_port, :guest => 3333, :host => 3333
31
32 %w(.ssh .chef .config).each do |dir|
33 dir = "#{Dir.home}/#{dir}"
34 Dir.mkdir(dir) unless Dir.exists?(dir)
35 end
36
37 unless File.exists?("~/.config/hub")
38 File.open("#{Dir.home}/.config/hub", "w+") do |file|
39 file.write "---
40 github.com:
41 - user: #{$github_user}
42 oauth_token: #{$github_oauth_token}"
43 end
44 end
45
46 config.vm.synced_folder "~/.ssh", "/home/vagrant/.ssh"
47 config.vm.synced_folder "~/.chef", "/home/vagrant/.chef"
48 config.vm.synced_folder "~/.config", "/home/vagrant/.config"
49 config.vm.network :private_network, :ip => "10.11.12.13"
50 config.vm.synced_folder "~/shared_devbox", "/User/work/devbox/Projects", :nfs => true, mount_options: ['rw', 'vers=3', 'tcp', 'fsc']
51 if Dir.exists?("/etc/chef")
52 config.vm.synced_folder "/etc/chef", "/etc/chef", :owner => "root", :group => "root"
53 end
54
55 config.vm.provider "vmware_fusion" do |provider|
56 provider.vmx["memsize"] = $memsize
57 provider.vmx["numvcpus"] = $numvcpus
58 end
59
60 config.vm.provider "virtualbox" do |provider|
61 provider.memory = $memsize
62 provider.cpus = $numvcpus
63 end
64 end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment