Skip to content

Instantly share code, notes, and snippets.

@tmatilai
Last active January 1, 2021 19:49
Show Gist options
  • Save tmatilai/7553006 to your computer and use it in GitHub Desktop.
Save tmatilai/7553006 to your computer and use it in GitHub Desktop.
My global Vagrant configuration (~/.vagrant.d/Vagrantfile)
# URI of the local (caching) HTTP proxy
LOCAL_HTTP_PROXY = 'http://192.168.33.200:8123'
# 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|
config.vm.provider :virtualbox do |vbox, override|
configure_caching(override)
vbox.memory = 512
end
config.vm.provider :vmware_fusion do |fusion, override|
configure_caching(override)
fusion.vmx['memsize'] = 512
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['USER']
aws.region = 'us-east-1'
aws.instance_type = 't1.micro'
aws.security_groups = ['default']
override.ssh.private_key_path = "#{ENV['HOME']}/.ssh/id_rsa"
end
config.vm.provider :digital_ocean do |ocean, override|
ocean.client_id = ENV['DIGITAL_OCEAN_CLIENT_ID']
ocean.api_key = ENV['DIGITAL_OCEAN_API_KEY']
ocean.ssh_key_name = ENV['USER']
ocean.region = 'New York 1'
ocean.size = '512MB'
override.ssh.private_key_path = "#{ENV['HOME']}/.ssh/id_rsa"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment