-
Notifications
You must be signed in to change notification settings - Fork 12
/
Vagrantfile
225 lines (203 loc) · 11.3 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Environment variables may be used to control the behavior of the Vagrant VM's
# defined in this file. This is intended as a special-purpose affordance and
# should not be necessary in normal situations. In particular, sensu-server and
# sensu-server-enterprise use the same IP address by
# default, creating a potential IP conflict. If there is a need to run multiple
# server instances simultaneously, avoid the IP conflict by setting the
# ALTERNATE_IP environment variable:
#
# ALTERNATE_IP=192.168.156.9 vagrant up sensu-server-enterprise
#
# NOTE: The client VM instances assume the server VM is accessible on the
# default IP address, therefore using an ALTERNATE_IP is not expected to behave
# well with client instances.
#
# When bringing up sensu-server-enterprise, the FACTER_SE_USER and
# FACTER_SE_PASS environment variables are required. See the README for more
# information on how to configure sensu enterprise credentials.
if not Vagrant.has_plugin?('vagrant-vbguest')
abort <<-EOM
vagrant plugin vagrant-vbguest is required.
https://github.com/dotless-de/vagrant-vbguest
To install the plugin, please run, 'vagrant plugin install vagrant-vbguest'.
EOM
end
if not Vagrant.has_plugin?('vagrant-reload')
abort <<-EOM
vagrant plugin vagrant-reload is required.
https://github.com/aidanns/vagrant-reload
To install the plugin, please run, 'vagrant plugin install vagrant-reload'.
EOM
end
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "512"]
end
config.vm.define "sensu-server", primary: true, autostart: true do |server|
server.vm.box = "centos/7"
server.vm.hostname = 'sensu-server.example.com'
server.vm.network :private_network, ip: ENV['ALTERNATE_IP'] || '192.168.156.10'
server.vm.network :forwarded_port, guest: 4567, host: 4567, auto_correct: true
server.vm.network :forwarded_port, guest: 3000, host: 3000, auto_correct: true
server.vm.network :forwarded_port, guest: 15672, host: 15672, auto_correct: true
server.vm.provision :shell, :path => "tests/provision_basic_el.sh"
server.vm.provision :shell, :path => "tests/provision_server.sh"
server.vm.provision :shell, :path => "tests/rabbitmq.sh"
server.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
end
config.vm.define 'sensu-server-cluster', autostart: false do |server|
server.vm.box = 'centos/7'
server.vm.hostname = 'sensu-server.example.com'
server.vm.network :private_network, ip: ENV['ALTERNATE_IP'] || '192.168.156.10'
server.vm.network :forwarded_port, guest: 4567, host: 4567, auto_correct: true
server.vm.network :forwarded_port, guest: 3000, host: 3000, auto_correct: true
server.vm.network :forwarded_port, guest: 15672, host: 15672, auto_correct: true
server.vm.provision :shell, :path => "tests/provision_basic_el.sh"
server.vm.provision :shell, :path => "tests/provision_server_cluster.sh"
server.vm.provision :shell, :path => "tests/rabbitmq.sh"
server.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
end
config.vm.define "sensu-server-puppet6", primary: true, autostart: true do |server|
server.vm.box = "centos/7"
server.vm.hostname = 'sensu-server.example.com'
server.vm.network :private_network, ip: ENV['ALTERNATE_IP'] || '192.168.156.10'
server.vm.network :forwarded_port, guest: 4567, host: 4567, auto_correct: true
server.vm.network :forwarded_port, guest: 3000, host: 3000, auto_correct: true
server.vm.network :forwarded_port, guest: 15672, host: 15672, auto_correct: true
server.vm.provision :shell, :path => "tests/provision_basic_el_puppet6.sh"
server.vm.provision :shell, :path => "tests/provision_server.sh"
server.vm.provision :shell, :path => "tests/rabbitmq.sh"
server.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
end
# sensu-server-enterprise is meant to be started without 'sensu-server'
# running.
config.vm.define 'sensu-server-enterprise', autostart: false do |server|
# Sensu Enterprise runs the JVM. If the API does not start, look for OOM
# errors in `/var/log/sensu/sensu-enterprise.log` as a possible cause.
# NB: The JVM HEAP_SIZE is also configured down to 256m from 2048m in
# `tests/sensu-server-enterprise.pp`
server.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', '768']
end
server.vm.box = 'centos/7'
server.vm.hostname = 'sensu-server.example.com'
server.vm.network :private_network, ip: ENV['ALTERNATE_IP'] || '192.168.156.10'
server.vm.network :forwarded_port, guest: 4567, host: 4567, auto_correct: true
server.vm.network :forwarded_port, guest: 4568, host: 4568, auto_correct: true
server.vm.network :forwarded_port, guest: 15672, host: 15672, auto_correct: true
server.vm.provision :shell, :path => 'tests/provision_basic_el.sh'
server.vm.provision :shell,
:path => 'tests/provision_enterprise_server.sh',
:env => {
'FACTER_SE_USER' => ENV['FACTER_SE_USER'].to_s,
'FACTER_SE_PASS' => ENV['FACTER_SE_PASS'].to_s,
}
server.vm.provision :shell, :path => 'tests/rabbitmq.sh'
server.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
end
# At this time does not work
# config.vm.define "el8-client", autostart: true do |client|
# client.vm.box = "centos/8"
# client.vm.hostname = 'el8-client.example.com'
# client.vm.network :private_network, ip: "192.168.156.21"
# client.vm.provision :shell, :path => "tests/provision_basic_el.sh"
# client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client.pp"
# client.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
# end
config.vm.define "el7-client", autostart: true do |client|
client.vm.box = "centos/7"
client.vm.hostname = 'el7-client.example.com'
client.vm.network :private_network, ip: "192.168.156.11"
client.vm.provision :shell, :path => "tests/provision_basic_el.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client.pp"
client.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
end
config.vm.define "el6-client", autostart: false do |client|
client.vm.box = "centos/6"
client.vm.hostname = 'el6-client.example.com'
client.vm.network :private_network, ip: "192.168.156.12"
client.vm.provision :shell, :path => "tests/provision_basic_el.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client-sensu_gem.pp"
client.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
end
config.vm.define "ubuntu1804-client", autostart: false do |client|
client.vm.box = "ubuntu/bionic64"
client.vm.hostname = 'ubuntu1804-client.example.com'
client.vm.network :private_network, ip: "192.168.156.18"
client.vm.provision :shell, :path => "tests/provision_basic_debian.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client.pp"
client.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
end
config.vm.define "ubuntu1604-client", autostart: false do |client|
client.vm.box = "ubuntu/xenial64"
client.vm.hostname = 'ubuntu1604-client.example.com'
client.vm.network :private_network, ip: "192.168.156.13"
client.vm.provision :shell, :path => "tests/provision_basic_debian.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client.pp"
client.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
end
config.vm.define "win2012r2-client", autostart: false do |client|
client.vm.box = "opentable/win-2012r2-standard-amd64-nocm"
client.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--cpus", "1"]
end
client.vm.hostname = 'win2012r2-client'
client.vm.network :private_network, ip: "192.168.156.15"
client.vm.network "forwarded_port", host: 3389, guest: 3389, auto_correct: true
# There are two basic power shell scripts. The first installs Puppet, but
# puppet is not in the PATH. The second invokes a new shell which will have
# Puppet in the PATH.
#
## Install Puppet and Powershell 5
client.vm.provision :shell, :path => "tests/provision_basic_win.ps1"
## Reload to apply Powershell 5 install
client.vm.provision :reload
## Symlink module into place, run puppet module install for puppet apply
client.vm.provision :shell, :path => "tests/provision_basic_win.2.ps1"
## Install Sensu using the default Windows package provider (MSI)
client.vm.provision :shell, :inline => 'iex "puppet apply -v C:/vagrant/tests/sensu-client-windows.pp"'
client.vm.provision :shell, :inline => 'iex "facter --custom-dir=C:/vagrant/lib/facter sensuclassic_version"'
end
config.vm.define "debian9-client", autostart: false do |client|
client.vm.box = "debian/stretch64"
client.vm.hostname = 'debian9-client.example.com'
client.vm.network :private_network, ip: "192.168.156.20"
client.vm.provision :shell, :path => "tests/provision_basic_debian.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client.pp"
client.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
end
config.vm.define "debian8-client", autostart: false do |client|
client.vm.box = "debian/jessie64"
client.vm.hostname = 'debian8-client.example.com'
client.vm.network :private_network, ip: "192.168.156.17"
client.vm.provision :shell, :path => "tests/provision_basic_debian.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client.pp"
client.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
end
# The rsync used to populate /vagrant will fail if the repo has the spec
# fixtures created. To avoid, run `rake spec_clean` before `vagrant up`.
config.vm.define "macos-client", autostart: false do |client|
client.vm.box = "jhcook/macos-sierra"
client.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
client.vm.hostname = 'macos-client.example.com'
client.vm.network :private_network, ip: "192.168.156.19"
client.vm.synced_folder ".", "/vagrant", type: "rsync", group: "wheel",
rsync__exclude: ['.git/', 'spec/']
client.vm.provision :shell, :path => "tests/provision_macos.sh"
client.vm.provision :shell, :inline => "/opt/puppetlabs/puppet/bin/puppet apply /vagrant/tests/sensu-client.pp"
client.vm.provision :shell, :inline => "/opt/puppetlabs/puppet/bin/facter --custom-dir=/vagrant/lib/facter sensuclassic_version"
client.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--usb", "on"]
vb.customize ["modifyvm", :id, "--usbehci", "off"]
end
end
end