forked from twindb/undrop-for-innodb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
72 lines (56 loc) · 1.81 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
nodes = [
{ :hostname => 'master1',
:box => 'bento/centos-7.3',
:ram => 3072
}]
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'
$script = <<SCRIPT
interface=enp0s3
if [[ $(cat /sys/class/net/${interface}/operstate) != 'up' ]]; then
service network restart
fi
function install_package() {
yum clean all
for i in 1 2 3
do
yum -y install $1 && break
done
}
function install_puppet(){
rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
install_package puppet
}
which puppet || install_puppet
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
nodes.each do |node|
config.vm.define node[:hostname] do |nodeconfig|
nodeconfig.vm.box = node[:box]
nodeconfig.vm.hostname = node[:hostname]
if node[:ip]
nodeconfig.vm.network :private_network, ip: node[:ip]
end
if node[:mysql_port]
nodeconfig.vm.network :forwarded_port, host: node[:mysql_port], guest: 3306
end
memory = node[:ram] ? node[:ram] : 256
nodeconfig.vm.provider :virtualbox do |vb|
vb.customize [
'modifyvm', :id,
'--cpuexecutioncap', '40',
'--memory', memory.to_s,
]
end
end
config.vm.synced_folder '..', '/undrop-for-innodb'
end
config.vm.box_check_update = false
config.vm.provision 'shell', inline: $script
config.vm.provision :puppet do |puppet|
puppet.environment_path = 'environment'
puppet.environment = 'puppet'
end
end