-
Notifications
You must be signed in to change notification settings - Fork 5
/
Vagrantfile
101 lines (71 loc) · 3.25 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# -*- mode: ruby -*-
# vi: set ft=ruby :
#############################
# Development Server Setup
#############################
require 'yaml'
default_config_file = File.join(File.dirname(__FILE__), 'config.yaml.dist')
local_config_file = File.join(File.dirname(__FILE__), 'config.yaml')
config_data = YAML.load_file default_config_file
config_data = Vagrant::Util::DeepMerge.deep_merge(config_data, YAML.load_file(local_config_file)) if File.exists? local_config_file
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define config_data['hostname'] do |v|
v.vm.box = config_data['box']
v.vm.hostname = config_data['hostname']
v.vm.synced_folder ".", "/vagrant", {
nfs: true,
mount_options: ["nolock", "actimeo=1", "async"]
}
v.vm.network "forwarded_port", guest: 5432, host: 5432
v.vm.provider :virtualbox do |vb, override|
vb.name = config_data['hostname']
override.vm.box = config_data['virtualbox_box'] if config_data.has_key? 'virtualbox_box'
vb.memory = config_data['ram']
vb.cpus = config_data['num_cpus']
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["setextradata", :id, "--VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
vb.customize ["guestproperty", "set", :id, "--timesync-threshold", "1000"]
vb.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
vb.linked_clone = true
override.vm.network "private_network", ip: "172.28.128.3"
end
# Configuration options for the VMware Fusion provider.
v.vm.provider :vmware_desktop do |vmw, override|
override.vm.box = config_data['vmware_box'] if config_data.has_key? 'vmware_box'
vmw.vmx["memsize"] = config_data['ram']
vmw.vmx["numvcpus"] = config_data['num_cpus']
end
# Configuration options for the Parallels provider.
v.vm.provider :parallels do |p, override|
p.name = config_data['hostname']
override.vm.box = config_data['parallels_box'] if config_data.has_key? 'parallels_box'
p.memory = config_data['ram']
p.cpus = config_data['num_cpus']
p.check_guest_tools = true
p.update_guest_tools = true
p.customize ["set", :id, "--longer-battery-life", "off"]
end
v.vm.provision :ansible do |ansible|
ansible.playbook = "ansible/playbooks/vagrant/init.yml"
ansible.galaxy_role_file = "ansible/roles.yml"
ansible.galaxy_roles_path = "ansible/roles"
ansible.compatibility_mode = "2.0"
ansible.host_vars = {
"development-vm" => {"ansible_python_interpreter" => "/usr/bin/python3"}
}
end
end
# Plugin specific options. Helpful for development but most likely not necessary for class
if Vagrant.has_plugin? "vagrant-dnsmasq"
config.dnsmasq.domain = ".test"
# overwrite default location for /etc/dnsmasq.conf
brew_prefix = `/usr/local/bin/brew --prefix`.strip
config.dnsmasq.dnsmasqconf = brew_prefix + '/etc/dnsmasq.conf'
# command for reloading dnsmasq after config changes
config.dnsmasq.reload_command = 'sudo brew services restart dnsmasq'
end
if Vagrant.has_plugin? 'vagrant-vbguest'
config.vbguest.no_install = true
end
end