-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathVagrantfile
67 lines (52 loc) · 1.75 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
APP_SERVERS = [
{ :name => "app1", :ip => "10.0.0.30",
:mem => "256" , :box => "ubuntu/trusty64",
:autostart => true
},
{ :name => "app2", :ip => "10.0.0.31",
:mem => "256" , :box => "ubuntu/trusty64",
:autostart => true
},
{ :name => "app3", :ip => "10.0.0.32",
:mem => "256" , :box => "ubuntu/trusty64",
:autostart => false
}
]
Vagrant.configure("2") do |config|
# main & default: normal OS series...
config.vm.define "lb", primary: true do |node|
node.vm.box = "ubuntu/trusty64"
node.vm.network "private_network", ip: "10.0.0.10"
#node.vm.network "forwarded_port", guest: 1936, host: 1936
node.vm.provision "ansible" do |ansible|
ansible.playbook = "lb.yml"
ansible.sudo = true
end
node.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "256"]
end
end
# app servers
APP_SERVERS.each do |opts|
config.vm.define opts[:name], autostart: opts[:autostart] do |node|
node.vm.box = opts[:box]
node.vm.network "private_network", ip: opts[:ip]
node.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", opts[:mem]]
end
node.vm.provision "ansible" do |ansible|
ansible.playbook = "wordpress.yml"
ansible.sudo = true
end
end
end
# DB server
config.vm.define "db" do |node|
node.vm.box = "ubuntu/trusty64"
node.vm.network "private_network", ip: "10.0.0.20"
node.vm.provision "ansible" do |ansible|
ansible.playbook = "db.yml"
ansible.sudo = true
end
end
end