-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
89 lines (70 loc) · 2.53 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
## Web Server #########################
config.vm.define :webserver do |web_config|
web_config.vm.box = "jpease/ubuntu-trusty"
web_config.vm.network "private_network", ip: "192.168.2.10"
web_config.vm.provider "vmware_fusion" do |v|
v.vmx['displayName'] = 'webserver'
v.vmx["numvcpus"] = '1'
v.vmx['memsize'] = '128'
end
web_config.vm.provision :ansible do |ansible|
ansible.inventory_path = "provisioning/ansible_hosts"
ansible.playbook = "provisioning/webserver.yml"
end
end
## HAProxy ############################
config.vm.define :haproxy do |haproxy_config|
haproxy_config.vm.box = "jpease/ubuntu-trusty"
haproxy_config.vm.network :private_network, ip: "192.168.2.20"
haproxy_config.vm.provider "vmware_fusion" do |v|
v.vmx['displayName'] = 'haproxy'
v.vmx["numvcpus"] = '1'
v.vmx['memsize'] = '128'
end
haproxy_config.vm.provision :ansible do |ansible|
ansible.inventory_path = "provisioning/ansible_hosts"
ansible.playbook = "provisioning/haproxy.yml"
end
end
## App Server #########################
app_hosts = {
"app_ruby_1" => "00",
"app_ruby_2" => "01"
}
app_hosts.each do |name, id|
config.vm.define name do |app_ruby_config|
ip = "192.168.2.1"+id
port = "30"+id
app_ruby_config.vm.box = "jpease/ubuntu-trusty"
app_ruby_config.vm.network :private_network, ip: ip
app_ruby_config.vm.network :forwarded_port, guest: 3000, host: port
app_ruby_config.vm.synced_folder "../", "/srv/www"
app_ruby_config.vm.provider "vmware_fusion" do |v|
v.vmx['displayName'] = name
v.vmx["numvcpus"] = '1'
v.vmx['memsize'] = '256'
end
app_ruby_config.vm.provision "ansible" do |ansible|
ansible.inventory_path = "provisioning/ansible_hosts"
ansible.playbook = "provisioning/app_ruby.yml"
end
end
end
## PostgreSQL Server #########################
config.vm.define :postgres do |postgres_config|
postgres_config.vm.box = "jpease/ubuntu-trusty"
postgres_config.vm.network :private_network, ip: "192.168.2.30"
postgres_config.vm.provider "vmware_fusion" do |v|
v.vmx['displayName'] = 'PostgreSQL'
v.vmx["numvcpus"] = '1'
v.vmx['memsize'] = '512'
end
postgres_config.vm.provision :ansible do |ansible|
ansible.inventory_path = "provisioning/ansible_hosts"
ansible.playbook = "provisioning/postgres.yml"
end
end
end