forked from xapi-project/testarossa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
143 lines (131 loc) · 5.18 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
LOCAL_BRANCH = ENV.fetch("LOCAL_BRANCH", "team-ring3-master")
USER = ENV.fetch("USER")
folders = {
# 'xs/rpms' => '/rpms',
# 'xs/opt' => '/opt',
'xs/sbin' => '/sbin',
'xs/bin' => '/bin',
# 'xs/boot' => '/boot',
# 'xs/usr/sbin' => '/usr/sbin',
'scripts' => '/scripts'
}
# This does not work with Vagrant 2.1.2 (FrozenError: can't modify frozen String):
# Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Disable default synced folder
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define "infrastructure" do |infra|
infra.vm.box = "jonludlam/xs-centos-7"
infra.vm.provision "shell", path: "scripts/infra/vagrant_provision.sh"
infra.vm.synced_folder "scripts/infra", "/scripts", type: "rsync", rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
infra.vm.network "public_network", bridge: "xenbr0"
config.vm.provider "xenserver" do |xs|
xs.name = "#{USER}/infrastructure/#{infra.vm.box}"
end
end
# (1..3).each do |i|
# config.vm.define "ely#{i}" do |host|
# host.vm.box = "jonludlam/ely"
# folders.each { |k,v| host.vm.synced_folder k, v, type: "rsync", rsync__args: ["--verbose", "--archive", "-z", "--copy-links"] }
# host.vm.network "public_network", bridge: "xenbr0"
# host.vm.provision "shell", path: "scripts/xs/update.sh"
# host.vm.provision :ansible do |ansible|
# ansible.groups = {
# "honolulu" => (1..3).map{|i| "honolulu#{i}"},
# "ely" => (1..3).map{|i| "ely#{i}"}
# }
# ansible.limit = "ely"
# ansible.playbook = "playbook.yml"
# end
# end
# end
# (1..3).each do |i|
# config.vm.define "honolulu#{i}" do |host|
# host.vm.box = "jonludlam/release-honolulu-master"
# folders.each { |k,v| host.vm.synced_folder k, v, type: "rsync", rsync__args: ["--verbose", "--archive", "-z", "--copy-links"] }
# host.vm.network "public_network", bridge: "xenbr0"
# host.vm.provision "shell", path: "scripts/xs/update.sh"
# host.vm.provision :ansible do |ansible|
# ansible.groups = {
# "honolulu" => (1..3).map{|i| "honolulu#{i}"}
# }
# ansible.limit = "honolulu"
# ansible.playbook = "playbook.yml"
# end
# end
# end
# (1..3).each do |i|
# hostname = "host#{i}"
# config.vm.define hostname do |host|
# host.vm.box = "xenserver/#{LOCAL_BRANCH}"
# host.vm.provision "shell",
# inline: "hostname host#{i}; echo #{hostname} > /etc/hostname"
# folders.each { |k,v| host.vm.synced_folder k, v, type: "rsync", rsync__args: ["--verbose", "--archive", "-z", "--copy-links"] }
#
# host.vm.provision "shell", path: "scripts/xs/update.sh"
# host.vm.network "public_network", bridge: "xenbr0"
# host.vm.network "public_network", bridge: "xenbr1"
# config.vm.provider "xenserver" do |xs|
# xs.name = "#{USER}/#{hostname}/#{host.vm.box}"
# end
# end
# end
# Defines cluster{1,2,3} for corosync investigation
N = 16
NAMES = Hash[ (1..N).map{|i| [i, "cluster#{i}"]} ]
(1..N).each do |i|
hostname = NAMES[i]
config.vm.define hostname do |host|
host.vm.box = "xenserver/#{LOCAL_BRANCH}"
host.vm.network "public_network", bridge: "xenbr0"
folders.each { |k,v| host.vm.synced_folder k, v, type: "rsync", rsync__args: ["--verbose", "--archive", "-z", "--copy-links"] }
host.vm.synced_folder "scripts", "/scripts", type:"rsync", rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
config.vm.provider "xenserver" do |xs|
xs.name = "#{USER}/#{hostname}/#{host.vm.box}"
end
host.vm.provision :ansible do |ansible|
ansible.groups = {
"cluster" => NAMES.collect { |k, v| v },
"infra" => ["infrastructure"]
}
ansible.limit = "cluster"
# ansible.verbose = "vvv"
ansible.playbook = "playbook.yml"
end
end
end
XN = 16
XNAMES = Hash[ (0..XN).map{|i| [i, "xcluster#{i}"]} ]
(1..XN).each do |i|
hostname = XNAMES[i]
config.vm.define hostname do |host|
host.vm.box = "xenserver/#{LOCAL_BRANCH}"
host.vm.network "public_network", bridge: "xenbr0"
folders.each { |k,v| host.vm.synced_folder k, v, type: "rsync", rsync__args: ["--verbose", "--archive", "-z", "--copy-links"] }
host.vm.synced_folder "scripts", "/scripts", type:"rsync", rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
config.vm.provider "xenserver" do |xs|
xs.name = "#{USER}/#{hostname}/#{host.vm.box}"
end
host.vm.provision :ansible do |ansible|
ansible.groups = {
"xcluster" => XNAMES[i]
}
ansible.limit = "xcluster"
# ansible.verbose = "vvv"
ansible.playbook = "playbook.yml"
end
host.vm.provision "shell", path: "scripts/xs/update.sh"
end
end
config.vm.provider "xenserver" do |xs|
xs.use_himn = true
xs.memory = 1024
xs.xs_host = "gandalf.uk.xensource.com"
xs.xs_username = "root"
xs.xs_password = "xenroot"
end
end