Skip to content

Instantly share code, notes, and snippets.

@davidski
Last active December 31, 2015 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidski/58aad904d81df0c74670 to your computer and use it in GitHub Desktop.
Save davidski/58aad904d81df0c74670 to your computer and use it in GitHub Desktop.
Global Vagrant Configuration (~/.vagrant.d/Vagrantfile)
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Based upon https://gist.github.com/tmatilai/7553006
LOCAL_HTTP_PROXY = 'NOPE'
KEY_PATH = "D:\Primary Docs\Google Drive\AWS Keypair\SSH Keypairs\#{ENV['AWS_KEYPAIR_NAME']}.pem"
USER_DATA = '#!/bin/bash\nmkdir -p /etc/chef/ohai/hints\ntouch /etc/chef/ohai/hints/ec2.json > /tmp/user_data.log\necho\n'
# Configures vagrant-cachier and vagrant-proxyconf.
# Should be called only on "local machine" providers.
def configure_caching(config)
if Vagrant.has_plugin?('vagrant-cachier')
config.cache.enable_nfs = true
config.cache.enable :gem
config.cache.enable :npm
end
if Vagrant.has_plugin?('vagrant-proxyconf')
config.proxy.http = LOCAL_HTTP_PROXY
config.proxy.https = LOCAL_HTTP_PROXY
config.proxy.no_proxy = 'localhost,127.0.0.1'
end
end
Vagrant.configure('2') do |config|
# https://github.com/mitchellh/vagrant/issues/3230#issuecomment-62588180
ENV['VAGRANT_DETECTED_OS'] = ENV['VAGRANT_DETECTED_OS'].to_s + ' cygwin'
config.vm.provider :vmware_workstation do |workstation|
# configure_caching(override)
workstation.vmx['memsize'] = 1024
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['AWS_KEYPAIR_NAME']
aws.region = 'us-west-2'
aws.instance_type = 't2.nano'
aws.security_groups = ['default']
# ensure that Chef's OHAI works for EC2
aws.user_data = USER_DATA
override.ssh.private_key_path = KEY_PATH
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment