-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathVagrantfile
More file actions
68 lines (58 loc) · 2.15 KB
/
Copy pathVagrantfile
File metadata and controls
68 lines (58 loc) · 2.15 KB
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# rubocop:disable Layout/LineLength
commands = [
# hack for https://github.com/mitchellh/vagrant/issues/1303
"echo 'Defaults env_keep += \"SSH_AUTH_SOCK\"' | sudo tee /etc/sudoers.d/agent",
# add github ssh hostkey
'[ -d /root/.ssh ] || sudo mkdir -p -m 0700 /root/.ssh && ssh-keyscan -H github.com | sudo tee /root/.ssh/known_hosts',
# bootstrap chef
'[ -f /etc/chef/client.rb ] || sudo /vagrant/scripts/chefctl.sh -b',
# run chef
'sudo /var/chef/repo/scale-chef/scripts/chefctl.sh -i',
]
provisioning_script = commands.join('; ')
# rubocop:enable Layout/LineLength
required_plugins = [
'vagrant-cachier',
'vagrant-hostmanager',
]
required_plugins.each do |plugin|
system "vagrant plugin install #{plugin}" unless Vagrant.has_plugin?(plugin)
end
Vagrant.configure('2') do |config|
if Vagrant.has_plugin?('vagrant-cachier')
config.cache.auto_detect = true
config.cache.scope = :box
end
if Vagrant.has_plugin?('vagrant-hostmanager')
config.hostmanager.enabled = true
config.hostmanager.manage_host = false
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
else
fail 'vagrant-hostmanager plugin not found'
end
config.ssh.forward_agent = true
config.vm.box = 'bento/centos-7.2'
config.vm.define 'scale-www1' do |v|
v.vm.hostname = 'scale-www1'
v.vm.network :private_network, :ip => '172.16.1.10'
v.vm.provision 'shell', :inline => provisioning_script, :privileged => false
end
config.vm.define 'scale-db1' do |v|
v.vm.hostname = 'scale-db1'
v.vm.network :private_network, :ip => '172.16.1.11'
v.vm.provision 'shell', :inline => provisioning_script, :privileged => false
end
config.vm.define 'scale-lists1' do |v|
v.vm.hostname = 'scale-lists1'
v.vm.network :private_network, :ip => '172.16.1.12'
v.vm.provision 'shell', :inline => provisioning_script, :privileged => false
end
config.vm.define 'scale-reg1' do |v|
v.vm.hostname = 'scale-reg1'
v.vm.network :private_network, :ip => '172.16.1.13'
v.vm.provision 'shell', :inline => provisioning_script, :privileged => false
end
end