This repository has been archived by the owner on Jul 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathVagrantfile
executable file
·66 lines (48 loc) · 1.74 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
hostname = 'rentrocket'
tld = 'vm'
fqdn = "#{hostname}.#{tld}"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/trusty64"
# Host and Network config
config.vm.define hostname do | h |
# puts "Ran config.vm.define for #{hostname}"
end
config.vm.hostname = hostname
config.ssh.forward_agent = true
config.vm.network :private_network, ip: "33.33.33.60"
config.vm.provider 'virtualbox' do |vb, override|
# Give VM access to all cpu cores on the host
cpus = case RbConfig::CONFIG['host_os']
when /darwin/ then `sysctl -n hw.ncpu`.to_i
when /linux/ then `nproc`.to_i
else 2
end
# Customize VM name
vb.customize ['modifyvm', :id, '--name', fqdn]
# Customize memory in MB
vb.customize ['modifyvm', :id, '--memory', 1024]
vb.customize ['modifyvm', :id, '--cpus', cpus]
# Fix for slow external network connections
vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
# vagrant-dns config
if Vagrant.has_plugin? 'vagrant-dns'
config.dns.tld = tld
config.dns.patterns = [/^.*rentrocket.vm$/]
# aliases.each do |host|
# config.vagrant-dns.host host, PRIVATE_IP
# end
else
puts 'vagrant-dns missing, please install the plugin:'
puts 'vagrant plugin install vagrant-dns'
end
end
config.vm.provision :shell, path: "bootstrap.sh"
end
# optional
VagrantDNS::Config.logger = Logger.new("dns.log")