forked from markt-de/puppet-galera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
113 lines (99 loc) · 3.92 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Change this to swap between a centos and an ubuntu box
box = 'precise64'
# 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.define "control1" do |control1|
control1.vm.box = box
control1.vm.network "private_network", ip: "192.168.99.101"
control1.vm.provider "virtualbox" do |v|
v.customize ['modifyvm', :id ,'--memory','1024']
end
control1.vm.hostname = 'control1'
if box == 'precise64'
control1.vm.provision :shell do |shell|
script =
"if grep 127.0.1.1 /etc/hosts ; then \n" +
" sed -i -e \"s/127.0.1.1.*/127.0.1.1 control1.domain.name control1/\" /etc/hosts\n" +
"else\n" +
" echo '127.0.1.1 control1.domain.name control1' >> /etc/hosts\n" +
"fi ;"
shell.inline = script
end
elsif box == 'centos64'
control1.vm.provision :shell do |shell|
shell.inline = "echo '192.168.99.101 control1.domain.name control1' > /etc/hosts;" +
"echo '127.0.0.1 control1 localhost localhost.localdomain localhost4 localhost4.localdomain4' >> /etc/hosts;" +
"echo '::1 localhost localhost.localdomain localhost6 localhost6.localdomain6' >> /etc/hosts;"
end
end
if ENV['http_mirror']
if box == 'precise64'
control1.vm.provision :shell do |shell|
shell.inline = "sed -i 's/us.archive.ubuntu.com/%s/g' /etc/apt/sources.list" % ENV['http_mirror']
end
end
end
if ENV['http_proxy']
if box == 'precise64'
control1.vm.provision :shell do |shell|
shell.inline = 'echo "Acquire::http { Proxy \"http://%s\"; };" > /etc/apt/apt.conf.d/01apt-cacher-ng-proxy;' % ENV['http_proxy']
end
end
end
control1.vm.provision "puppet" do |puppet|
puppet.manifests_path = "examples"
puppet.manifest_file = "site.pp"
puppet.module_path = 'modules'
puppet.options = ['--pluginsync', '--debug']
end
end
config.vm.define "control2" do |control2|
control2.vm.box = box
control2.vm.network "private_network", ip: "192.168.99.102"
control2.vm.provider "virtualbox" do |v|
v.customize ['modifyvm', :id ,'--memory','1024']
end
control2.vm.hostname = 'control2'
if box == 'precise64'
control2.vm.provision :shell do |shell|
script =
"if grep 127.0.1.1 /etc/hosts ; then \n" +
" sed -i -e \"s/127.0.1.1.*/127.0.1.1 control2.domain.name control2/\" /etc/hosts\n" +
"else\n" +
" echo '127.0.1.1 control2.domain.name control2' >> /etc/hosts\n" +
"fi ;"
shell.inline = script
end
end
if box == 'centos64'
control2.vm.provision :shell do |shell|
shell.inline = "echo '192.168.99.102 control2.domain.name control2' > /etc/hosts;" +
"echo '127.0.0.1 control2 localhost localhost.localdomain localhost4 localhost4.localdomain4' >> /etc/hosts;" +
"echo '::1 localhost localhost.localdomain localhost6 localhost6.localdomain6' >> /etc/hosts;"
end
end
if ENV['http_mirror']
if box == 'precise64'
control1.vm.provision :shell do |shell|
shell.inline = "sed -i 's/us.archive.ubuntu.com/%s/g' /etc/apt/sources.list" % ENV['http_mirror']
end
end
end
if ENV['http_proxy']
if box == 'precise64'
control1.vm.provision :shell do |shell|
shell.inline = 'echo "Acquire::http { Proxy \"http://%s\"; };" > /etc/apt/apt.conf.d/01apt-cacher-ng-proxy;' % ENV['http_proxy']
end
end
end
control2.vm.provision "puppet" do |puppet|
puppet.manifests_path = "examples"
puppet.manifest_file = "site.pp"
puppet.module_path = 'modules'
puppet.options = ['--pluginsync']
end
end
end