Skip to content

Instantly share code, notes, and snippets.

@maxlinc
Last active August 29, 2015 14:00
Show Gist options
  • Save maxlinc/11051223 to your computer and use it in GitHub Desktop.
Save maxlinc/11051223 to your computer and use it in GitHub Desktop.
Proposed Vagrantfile
# -*- 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|
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.ssh.username = "travis"
# Boxes
config.vm.define "linux" do |linux|
linux.vm.provision "shell", :inline => `travis run --print`
linux.vm.box = "travis/travis-worker-linux"
end
config.vm.define "windows" do |windows|
windows.vm.provision "shell", :inline => `travis run --print --target windows`
windows.vm.box = "travis/travis-worker-windows"
windows.winrm.username = 'Administrator' # Can we make it travis?
config.winrm.password = ENV['WINRM_PASS']
config.vm.synced_folder ".", "/vagrant", disabled: true # I don't know a secure synced folder solution across windows/linux/osx hosts yet
# I'm thinking about working around it by cloning samples projects via git instead
# rather than rsync/nfs/samba
# I have a working spike of Windows on vagrant-rackspace, but it requires a bit of extra config
windows.vm.provider "rackspace" do |rs, override|
rs.admin_pass = ENV['WINRM_PASS']
rs.personality = [
{
:path => 'C:\\cloud-automation\\bootstrap.cmd',
:contents => 'bootstrap.cmd', # Script to configure winrm endpoint
:encode_options => {:crlf_newline => true} # Windows line endings
}
]
end
end
# I don't know of many available osx VM images...
config.vm.define "osx" do |osx|
osx.vm.provision "shell", :inline => `travis run --print --target osx`
osx.vm.box = "travis/travis-worker-osx"
end
# Possible providers
# Most common choice for local testing
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
# Probably faster, not free
config.vm.provider "vmware_fusion" do |v|
v.vmx["memsize"] = "1024"
v.vmx["numvcpus"] = "2"
end
# Distributed with Windows, but has some limitations, including breaking virtualbox/vmware
config.vm.provider "hyperv" do |v|
end
# Cloud providers
# Vagrant azure is still WIP
# config.vm.provider :azure do |azure|
# end
config.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['AWS_ACCESS_KEY']
aws.secret_access_key = ENV['AWS_SECRET_KEY']
aws.keypair_name = ENV['TRAVIS_KEYPAIR']
override.ssh.private_key_path = "~/.ssh/id_rsa"
end
config.vm.provider :rackspace do |rs, override|
rs.username = ENV['RAX_USERNAME']
rs.api_key = ENV['RAX_API_KEY']
rs.region = ENV['RAX_REGION'] # e.g. dfw
rs.flavor = /2 GB Performance/ # Might be wrong, but I think 2 GB is the min for Windows 2012
rs.key_name = ENV['TRAVIS_KEYPAIR']
override.ssh.private_key_path = "~/.ssh/id_rsa"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment