-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathlab-04-Vagrantfile
144 lines (110 loc) · 5.36 KB
/
lab-04-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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Vagrantfile template
# hostnames are hard coded in following locations:
# cerebro|files|post-receive
# manos::default
#
# do NOT just "vagrant up" this whole cluster. not recommended.
# currently, need to do startup.sh and then vagrant up the machines one by on in this order
# cerebro, brazos, espina, hombros, manos, cara
# Berksfile tip: if dependency issues, delete Berksfile.lock. Note it's in .gitignore.
# dependencies:
# manos => cerebro
# manos => hombros
# hombros => brazos
# hombros => espina
# hombros => cerebro
# cara => espina
module OS
def OS.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end
def OS.mac?
(/darwin/ =~ RUBY_PLATFORM) != nil
end
def OS.unix?
!OS.windows?
end
def OS.linux?
OS.unix? and not OS.mac?
end
end
puts "Lab 04 - fan in/out config"
Vagrant.configure(2) do |config|
if OS.windows?
puts "Launching from windows."
config.vm.box = "opscode-ubuntu-14.04a" # does not support multi-pipeline yet. box stashed local to user.
else
puts "Launching from linux/mac"
# pull from common location. Supports multiple pipelines.
config.vm.box = "opscode-ubuntu-14.04a"
#config.vm.box_url = "/var/vagrant/boxes/opscode-ubuntu-14.04a.box"
end
config.berkshelf.enabled = true
config.berkshelf.berksfile_path = "~/Calavera/Berksfile"
# how to boost capacity
#config.vm.provider :virtualbox do |virtualbox|
#virtualbox.customize ["modifyvm", :id, "--memory", "1024"] # e.g. for Chef Server
#virtualbox.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
#end
###############################################################################
################################### manos03 ##############################
###############################################################################
config.vm.define "manos03" do | manos03 |
manos03.vm.host_name ="manos03.calavera.biz"
manos03.vm.network "private_network", ip: "10.1.0.23", virtualbox__intnet: "Cala1"
manos03.vm.network "forwarded_port", guest: 22, host: 2123, auto_correct: true
manos03.vm.network "forwarded_port", guest: 80, host: 8123, auto_correct: true
manos03.vm.network "forwarded_port", guest: 8080, host: 9123, auto_correct: true
manos03.ssh.forward_agent =true
manos03.vm.synced_folder ".", "/home/manos03"
# manos03.vm.synced_folder "./shared", "/mnt/shared"
#manos03.vm.provision :shell, path: "./shell/manos03.sh"
manos03.vm.provision :chef_zero do |chef|
chef.cookbooks_path = ["~/Calavera/cookbooks/"]
chef.data_bags_path = ["~/Calavera/data_bags/"]
chef.nodes_path = ["~/Calavera/nodes/"]
chef.roles_path = ["~/Calavera/roles/"]
chef.add_recipe "shared::_apt-update"
chef.add_recipe "git::default"
chef.add_recipe "localAnt::default"
chef.add_recipe "java7::default" # this is redundant. we already installed this in base and tomcat also installs Java. but won't work w/o it.
chef.add_recipe "localTomcat::v8"
chef.add_recipe "shared::_junit"
chef.add_recipe "manos::default"
#chef.add_recipe "manos::git-remote"
end
end
# test: http://10.1.0.14:8080/MainServlet
# or http://127.0.0.1:9122/MainServlet
# if cerebro is configured:
# cd /home/hijo #make a change
# git add .
# git commit -m "some message"
# git push origin master
###############################################################################
################################### cara03 ##############################
###############################################################################
config.vm.define "cara03" do | cara03 |
cara03.vm.host_name ="cara03.calavera.biz"
cara03.vm.network "private_network", ip: "10.1.0.53", virtualbox__intnet: "Cala1"
cara03.vm.network "forwarded_port", guest: 22, host: 2153, auto_correct: true
cara03.vm.network "forwarded_port", guest: 80, host: 8153, auto_correct: true
cara03.vm.network "forwarded_port", guest: 8080, host: 9153, auto_correct: true
cara03.ssh.forward_agent =true
cara03.vm.synced_folder ".", "/home/cara03"
# cara03.vm.synced_folder "./shared", "/mnt/shared"
#cara03.vm.provision :shell, path: "./shell/cara03.sh"]
cara03.vm.provision :chef_zero do |chef|
chef.cookbooks_path = ["~/Calavera/cookbooks/"]
chef.data_bags_path = ["~/Calavera/data_bags/"]
chef.nodes_path = ["~/Calavera/nodes/"]
chef.roles_path = ["~/Calavera/roles/"]
chef.add_recipe "shared::_apt-update"
chef.add_recipe "java7::default"
chef.add_recipe "localTomcat::v8"
chef.add_recipe "cara::cara03"
end
end
# test: curl http://10.1.0.62:8080/MainServlet
# or curl http://127.0.0.1:91XX/MainServlet (8080 forwarded port, see above)
end