Last active
February 8, 2016 19:24
-
-
Save lsdr/9218337 to your computer and use it in GitHub Desktop.
This file contains 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
# My helpers | |
# | |
def fwd_ports(config, ports=[]) | |
Array[*ports].each do |port| | |
config.vm.network :forwarded_port, guest: port, host: port | |
end | |
end | |
def share_folder(config, source, destiny) | |
if File.directory? File.expand_path(source) | |
config.vm.synced_folder source, destiny | |
end | |
end | |
# Vagrant DSL | |
# | |
Vagrant.configure("2") do |config| | |
config.vm.box = "arch64" | |
config.vm.box_url = "http://vagrant.srijn.net/archlinux-x64-2014-01-07.box" | |
config.vm.hostname = "development" | |
config.ssh.forward_agent = true | |
config.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] | |
vb.customize ["modifyvm", :id, "--memory", "512"] | |
vb.customize ["modifyvm", :id, "--cpus", "1"] | |
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "90"] | |
end | |
fwd_ports config, 3000..3010 | |
fwd_ports config, 3020..3021 | |
fwd_ports config, 8000..8010 | |
fwd_ports config, 9000..9010 | |
share_folder config, "~/Temp", "/home/vagrant/tmp" | |
end |
This file contains 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
$ cat 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| | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.network "private_network", ip: "10.0.0.10" | |
config.ssh.forward_agent = true | |
[3000, 5432, 9200].each do |port| | |
config.vm.network "forwarded_port", guest: port, host: port | |
end | |
config.vm.provider "virtualbox" do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "2048"] | |
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] | |
end | |
config.vm.provision "ansible" do |ansible| | |
ansible.playbook = "ansible/playbook.yml" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment