Last active
December 31, 2015 16:33
-
-
Save davidski/58aad904d81df0c74670 to your computer and use it in GitHub Desktop.
Global Vagrant Configuration (~/.vagrant.d/Vagrantfile)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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