-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
246 lines (227 loc) · 7.42 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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Vagrantfile for chef-rep (creates workstation VM plus a bunch of clients)
# 201908.24MeV upgrade to latest chef workstation (DK depricated) and Infra client
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
# config.vm.network 'forwarded_port', guest: 80, host: 8080
config.vm.synced_folder '.', '/vagrant', disabled: false
config.vm.provider :virtualbox do |vb|
#vb.gui = true
vb.memory = '1024'
end
# insert the following for working behind a proxy server
# https won't work well, but http is fine
# if Vagrant.has_plugin?("vagrant-proxyconf")
# config.proxy.http = "http://www-proxy.us.oracle.com:80"
# config.proxy.https = "https://www-proxy.us.oracle.com:80"
# config.proxy.no_proxy = "localhost,127.0.0.1,.local"
# end
#
# PROVISION ON ALL MACHINES
# -- allow ssh w/o checking
#
config.vm.provision "shell", inline: <<SHELLALL
echo "...disabling ssh CheckHostIP..."
sed -i.orig -e "s/# CheckHostIP yes/CheckHostIP no/" /etc/ssh/ssh_config
# install older chef client on all nodes...it doesn't ask for license verification
# this will NOT run chef whereas the code below *will* install and run chef
echo "installing chef client..."
curl -L https://omnitruck.chef.io/install.sh >chef-install.sh 2>&1
bash ./chef-install.sh -v 14.13.11 >chef-install.log 2>&1
# cat chef-install.log
SHELLALL
# install older chef client which doesn't ask for license verification
# config.vm.provision "chef_zero" do |chef|
# chef.install = true
# chef.product = 'chef'
# chef.channel = 'current'
# chef.version = '14.13.11'
# chef.nodes_path = 'nodes'
# end
##-------------------------------------------------------------------------------
# configure a Chef Workstation (RHEL 6+7, SuSE 11+12, Ubuntu 16.04+18.04)
# https://docs.chef.io/platforms.html
# https://downloads.chef.io/chef-workstation/0.8.7
##-------------------------------------------------------------------------------
config.vm.define "ws_c6" do |ws_c6|
ws_c6.vm.box = "bento/centos-6"
ws_c6.vm.network 'private_network', ip: '192.168.10.106'
ws_c6.vm.hostname = 'ws-c6'
ws_c6.vm.provision "shell", inline: %q|
yum install -y python libselinux-python
echo "installing chefdk"
|
ws_c6.vm.provision "chef_zero" do |chef|
chef.node_name = 'ws-c6'
chef.product = 'chefdk'
chef.channel = 'current'
chef.version = '4.3.13'
chef.install = false
chef.cookbooks_path = "cookbooks"
chef.data_bags_path = "data_bags"
chef.nodes_path = "nodes"
chef.roles_path = "roles"
# chef.add_role "common_role"
# chef.arguments = [""]
end
end
config.vm.define "ws_c7" do |ws_c7|
ws_c7.vm.box = "centos/7"
ws_c7.vm.network 'private_network', ip: '192.168.10.107'
ws_c7.vm.hostname = 'ws-c7'
ws_c7.vm.provision "shell", inline: %q|
yum install -y python libselinux-python
echo "...installing chefdk"
|
ws_c7.vm.provision "chef_zero" do |chef|
chef.node_name = 'ws-c7'
chef.product = 'chefdk'
chef.channel = 'current'
chef.version = '4.3.13'
chef.install = false
chef.cookbooks_path = "cookbooks"
chef.data_bags_path = "data_bags"
chef.nodes_path = "nodes"
chef.roles_path = "roles"
# chef.add_role "common_role"
# chef.arguments = [""]
end
end
# note: dpkg writes it's crap to stderr, so the 1>&2 is reversed
# dpkg cannot be made to install silently...it's uses mmap
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=288778 (11years old!)
config.vm.define "ws_u16" do |ws_u16|
ws_u16.vm.box = "ubuntu/xenial64"
ws_u16.vm.network 'private_network', ip: '192.168.10.116'
ws_u16.vm.hostname = 'ws-u16'
ws_u16.vm.provision "shell", inline: %q|
apt-get update -y
echo "...installing chefdk..."
|
ws_u16.vm.provision "chef_zero" do |chef|
chef.node_name = 'ws-u16'
chef.product = 'chefdk'
chef.channel = 'current'
chef.version = '4.3.13'
chef.install = false
chef.cookbooks_path = "cookbooks"
chef.data_bags_path = "data_bags"
chef.nodes_path = "nodes"
chef.roles_path = "roles"
# chef.add_role "common_role"
# chef.arguments = [""]
end
end
config.vm.define "ws_u18" do |ws_u18|
ws_u18.vm.box = "ubuntu/bionic64"
ws_u18.vm.network 'private_network', ip: '192.168.10.118'
ws_u18.vm.hostname = 'ws-u18'
ws_u18.vm.provision "shell", inline: %q|
apt-get update -y
echo "......installing chefdk..."
|
ws_u18.vm.provision "chef_zero" do |chef|
chef.node_name = 'ws-u16'
chef.product = 'chefdk'
chef.channel = 'current'
chef.version = '4.3.13'
chef.install = false
chef.cookbooks_path = "cookbooks"
chef.data_bags_path = "data_bags"
chef.nodes_path = "nodes"
chef.roles_path = "roles"
# chef.add_role "common_role"
# chef.arguments = [""]
end
end
##-------------------------------------------------------------------------------
# configure chef nodes
# https://downloads.chef.io/chef/15.2.20
##-------------------------------------------------------------------------------
config.vm.define "node_c6" do |node_c6|
node_c6.vm.box = "bento/centos-6"
node_c6.vm.network 'private_network', ip: '192.168.10.206'
node_c6.vm.hostname = 'node-c6'
node_c6.vm.provision "shell", inline: %q|
yum install -y python libselinux-python
|
node_c6.vm.provision "chef_zero" do |chef|
chef.node_name = 'node-c6'
chef.install = false
chef.product = 'chef'
chef.channel = 'stable'
# chef.version = '14.13.11'
chef.cookbooks_path = "cookbooks"
chef.data_bags_path = "data_bags"
chef.nodes_path = "nodes"
chef.roles_path = "roles"
# chef.add_role "common_role"
# chef.arguments = [""]
end
end
config.vm.define "node_c7" do |node_c7|
node_c7.vm.box = "centos/7"
node_c7.vm.network 'private_network', ip: '192.168.10.207'
node_c7.vm.hostname = 'node-c7'
node_c7.vm.provision "shell", inline: %q|
yum install -y python libselinux-python
|
node_c7.vm.provision "chef_zero" do |chef|
chef.node_name = 'node-c7'
chef.install = false
chef.product = 'chef'
chef.channel = 'stable'
# chef.version = '14.13.11'
chef.cookbooks_path = "cookbooks"
chef.data_bags_path = "data_bags"
chef.nodes_path = "nodes"
chef.roles_path = "roles"
# chef.add_role "common_role"
# chef.arguments = [""]
end
end
config.vm.define "node_u16" do |node_u16|
node_u16.vm.box = "ubuntu/xenial64"
node_u16.vm.network 'private_network', ip: '192.168.10.216'
node_u16.vm.hostname = 'node-u16'
node_u16.vm.provision "shell", inline: %q|
apt-get update -y
|
node_u16.vm.provision "chef_zero" do |chef|
chef.node_name = 'node-u16'
chef.install = false
chef.product = 'chef'
chef.channel = 'stable'
# chef.version = '14.13.11'
chef.cookbooks_path = "cookbooks"
chef.data_bags_path = "data_bags"
chef.nodes_path = "nodes"
chef.roles_path = "roles"
# chef.add_role "common_role"
# chef.arguments = [""]
end
end
config.vm.define "node_u18" do |node_u18|
node_u18.vm.box = "ubuntu/bionic64"
node_u18.vm.network 'private_network', ip: '192.168.10.218'
node_u18.vm.hostname = 'node-u18'
node_u18.vm.provision "shell", inline: %q|
apt-get update -y
|
node_u18.vm.provision "chef_zero" do |chef|
chef.node_name = 'node-u18'
chef.install = false
chef.product = 'chef'
chef.channel = 'stable'
# chef.version = '14.13.11'
chef.cookbooks_path = "cookbooks"
chef.data_bags_path = "data_bags"
chef.nodes_path = "nodes"
chef.roles_path = "roles"
# chef.add_role "common_role"
# chef.arguments = [""]
end
end
end