Skip to content

Instantly share code, notes, and snippets.

@lonniev
Created December 15, 2014 04:59
Show Gist options
  • Save lonniev/8ab5dacf10cb877cf717 to your computer and use it in GitHub Desktop.
Save lonniev/8ab5dacf10cb877cf717 to your computer and use it in GitHub Desktop.
A Vagrantfile attempting to set up 3 VMs for development, test, and deploy of a distributed app
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :machine
end
config.omnibus.chef_version = :latest
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Use NFS for shared folders for better performance
config.vm.network "private_network", type: "dhcp"
# Ensure that all Windows networks are set to "Work" private (for WinRM to work)
config.windows.set_work_network = true
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
# config.ssh.forward_agent = true
config.vm.define "vb-tt-dev", primary: true do | vmh |
vmh.vm.box = "trusty64"
vmh.vm.hostname = "tt-dev"
vmh.vm.provider "virtualbox" do |vb|
vb.gui = true
# vb.customize ["modifyvm", :id, "--memory", "1024"]
end
vmh.vm.synced_folder '.', '/vagrant', nfs: true
# Share an additional folder to the guest VM. The first argument is
# 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.
vmh.vm.synced_folder "./installables", "/opt/vagrant/installables", nfs: true
vmh.vm.provision "chef_solo" do |chef|
chef.log_level = :warn
chef.custom_config_path = "Vagrantfile.chef"
chef.encrypted_data_bag_secret_key_path = "~/.chef/encrypted_data_bag_secret"
chef.cookbooks_path = "./cookbooks"
chef.roles_path = "./roles"
chef.data_bags_path = "./bags"
chef.add_recipe "apt"
chef.json = { "apt" => {"compiletime" => true} }
chef.add_role "ubuntu-linux-gui-user"
chef.add_role "eclipse-developer"
chef.add_role "integrity-developer"
end
end
config.vm.define "vb-tt-intg", primary: false do | vmh |
vmh.vm.box = "winXp32_ptcIntegrity"
vmh.vm.box_url = "https://vagrantcloud.com/lonniev/boxes/winXp32_ptcIntegrity"
vmh.vm.guest = :windows
vmh.vm.communicator = "winrm"
vmh.vm.hostname = "intg-client"
vmh.vm.provider "virtualbox" do |vb|
vb.gui = true
# vb.customize ["modifyvm", :id, "--memory", "1024"]
end
end
config.vm.define "vb-tt-sync", primary: false do | vmh |
vmh.vm.box = "lonniev/vagrant-win7-ie10"
vmh.vm.box_url = "https://vagrantcloud.com/lonniev/boxes/vagrant-win7-ie10"
vmh.vm.guest = :windows
vmh.vm.communicator = "winrm"
# Port forward WinRM and RDP
vmh.vm.network :forwarded_port, guest: 3389, host: 3389
vmh.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true
vmh.vm.hostname = "tt-sync"
vmh.vm.provider "virtualbox" do |vb|
vb.gui = true
# vb.customize ["modifyvm", :id, "--memory", "1024"]
end
vmh.vm.provision "chef_solo" do |chef|
chef.log_level = :debug
chef.custom_config_path = "Vagrantfile.chef"
chef.cookbooks_path = "./cookbooks"
chef.roles_path = "./roles"
chef.data_bags_path = "./bags"
chef.add_role "tasktop-sync-server"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment