Skip to content

Instantly share code, notes, and snippets.

@jjneely
Created February 9, 2018 02:11
Show Gist options
  • Save jjneely/be0de914e61ee4b4623514c2e7e5557c to your computer and use it in GitHub Desktop.
Save jjneely/be0de914e61ee4b4623514c2e7e5557c to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.provider 'virtualbox' do |v|
v.memory = ENV.fetch('VAGRANT_MEMORY_SIZE', 4096)
v.cpus = 2
v.customize ['modifyvm', :id, '--nictype1', 'virtio']
end
# Default to Ubuntu Xenial
distro = ENV.fetch('VAGRANT_DISTRO', 'xenial')
hostname = "vagrant-ubuntu-#{distro}-64"
fqdn = "#{hostname}.local"
config.vm.box = "ubuntu/#{distro}64"
#config.vm.box_url = "https://cloud-images.ubuntu.com/#{distro}/current/#{distro}-server-cloudimg-amd64-vagrant.box"
# Currently the ubuntu cloud image does not have a vagrant user/key ect.
# https://bugs.launchpad.net/cloud-images/+bug/1569237
if distro == 'xenial'
config.ssh.username = 'ubuntu'
end
config.vm.provider :virtualbox do |vb|
vb.name = "xenial-foobar"
end
config.vm.network "forwarded_port", guest: 8081, host: 8081, host_ip: '127.0.0.1', auto_correct: true
config.vm.network "forwarded_port", guest: 2003, host: 2003, host_ip: '127.0.0.1', auto_correct: true
config.vm.provision 'shell', inline: <<-SHELL
sudo bash -c 'echo "#{fqdn}" > /etc/hostname'
sudo bash -c 'echo "127.0.0.1 #{fqdn}" > /etc/hosts'
sudo hostname '#{fqdn}'
sudo apt-get update
sudo apt-get install -y build-essential liblmdb-dev lmdb-doc lmdb-dbg lmdb-utils git autoconf libssl-dev
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment