Skip to content

Commit fac3bde

Browse files
sbotmanwilderrodrigues
authored andcommitted
Adding the Vagrant configuration that will build xen and db servers.
1 parent 6e49675 commit fac3bde

3 files changed

Lines changed: 192 additions & 0 deletions

File tree

tools/vagrant/devcloud/Vagrantfile

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5+
VAGRANTFILE_API_VERSION = "2"
6+
7+
$mysql_script = <<SCRIPT
8+
hostname db
9+
echo nameserver 8.8.8.8 > /etc/resolv.conf
10+
yum install mysql-server -y
11+
service mysqld start
12+
chkconfig mysqld on
13+
/usr/bin/mysqladmin -u root password 'cloud'
14+
mysql -uroot -pcloud -e "use mysql;GRANT ALL ON *.* to root@'%' IDENTIFIED BY 'cloud' WITH GRANT OPTION; FLUSH PRIVILEGES;"
15+
16+
mkdir -p /opt/storage/secondary
17+
echo "/opt/storage/secondary *(rw,no_root_squash)" > /etc/exports
18+
service nfs start
19+
20+
mkdir -p /opt/storage/secondary/template/tmpl/1/1
21+
cd /opt/storage/secondary/template/tmpl/1/1
22+
cp /vagrant/templates/tmpl/1/1/systemvmtemplate.vhd.bz2 .
23+
bzip2 -d systemvmtemplate.vhd.bz2
24+
mv systemvmtemplate.vhd edd5d5e5-b363-4926-a85b-d742ddd4a801.vhd
25+
26+
checksum=$(md5sum edd5d5e5-b363-4926-a85b-d742ddd4a801.vhd | cut -f 1 -d " ")
27+
cat > template.properties <<TEMPLATE
28+
filename=edd5d5e5-b363-4926-a85b-d742ddd4a801.vhd
29+
vhd=true
30+
id=1209
31+
vhd.filename=edd5d5e5-b363-4926-a85b-d742ddd4a801.vhd
32+
public=true
33+
uniquename=routing-1
34+
vhd.virtualsize=2097152000
35+
virtualsize=2097152000
36+
checksum=${checksum}
37+
hvm=false
38+
description=SystemVM Template (XenServer)
39+
vhd.size=2101252608
40+
size=2101252608
41+
TEMPLATE
42+
43+
mkdir -p /opt/storage/secondary/template/tmpl/1/5
44+
cd /opt/storage/secondary/template/tmpl/1/5
45+
cp /vagrant/templates/tmpl/1/5/ce5b212e-215a-3461-94fb-814a635b2215.vhd .
46+
cp /vagrant/templates/tmpl/1/5/template.properties .
47+
48+
SCRIPT
49+
50+
$xen_script = <<SCRIPT
51+
hostname xen
52+
xe pif-scan host-uuid=$(xe host-list --minimal)
53+
xe pif-plug uuid=$(xe pif-list device=eth1 --minimal)
54+
xe network-param-set name-label=xenbr0 uuid=$(xe network-list bridge=xenbr0 --minimal)
55+
xe network-param-set name-label=xenbr1 uuid=$(xe network-list bridge=xenbr1 --minimal)
56+
57+
xe pif-reconfigure-ip mode=static uuid=$(xe pif-list device=eth1 --minimal) IP=192.168.56.234 netmask=255.255.255.0
58+
xe host-management-reconfigure pif-uuid=$(xe pif-list device=eth1 --minimal)
59+
60+
SCRIPT
61+
62+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
63+
# All Vagrant configuration is done here. The most common configuration
64+
# options are documented and commented below. For a complete reference,
65+
# please see the online documentation at vagrantup.com.
66+
67+
# Every Vagrant virtual environment requires a box to build off of.
68+
69+
config.vm.define "xen" do |xen|
70+
xen.vm.box = "duffy/xenserver"
71+
xen.vm.provision "shell", inline: $xen_script
72+
end
73+
74+
config.vm.define "db" do |db|
75+
db.vm.box = "chef/centos-6.5"
76+
db.vm.network "private_network", ip: "192.168.56.94"
77+
db.vm.network "forwarded_port", guest: 3306, host: 3306
78+
db.vm.provision "shell", inline: $mysql_script
79+
80+
end
81+
82+
# Disable automatic box update checking. If you disable this, then
83+
# boxes will only be checked for updates when the user runs
84+
# `vagrant box outdated`. This is not recommended.
85+
# config.vm.box_check_update = false
86+
87+
# Create a forwarded port mapping which allows access to a specific port
88+
# within the machine from a port on the host machine. In the example below,
89+
# accessing "localhost:8080" will access port 80 on the guest machine.
90+
# config.vm.network "forwarded_port", guest: 80, host: 8080
91+
92+
# Create a private network, which allows host-only access to the machine
93+
# using a specific IP.
94+
# config.vm.network "private_network", ip: "192.168.33.10"
95+
96+
# Create a public network, which generally matched to bridged network.
97+
# Bridged networks make the machine appear as another physical device on
98+
# your network.
99+
# config.vm.network "public_network"
100+
101+
# If true, then any SSH connections made will enable agent forwarding.
102+
# Default value: false
103+
# config.ssh.forward_agent = true
104+
105+
# Share an additional folder to the guest VM. The first argument is
106+
# the path on the host to the actual folder. The second argument is
107+
# the path on the guest to mount the folder. And the optional third
108+
# argument is a set of non-required options.
109+
# config.vm.synced_folder "../data", "/vagrant_data"
110+
111+
# Provider-specific configuration so you can fine-tune various
112+
# backing providers for Vagrant. These expose provider-specific options.
113+
# Example for VirtualBox:
114+
#
115+
# config.vm.provider "virtualbox" do |vb|
116+
# # Don't boot with headless mode
117+
# vb.gui = true
118+
#
119+
# # Use VBoxManage to customize the VM. For example to change memory:
120+
# vb.customize ["modifyvm", :id, "--memory", "1024"]
121+
# end
122+
#
123+
# View the documentation for the provider you're using for more
124+
# information on available options.
125+
126+
# Enable provisioning with CFEngine. CFEngine Community packages are
127+
# automatically installed. For example, configure the host as a
128+
# policy server and optionally a policy file to run:
129+
#
130+
# config.vm.provision "cfengine" do |cf|
131+
# cf.am_policy_hub = true
132+
# # cf.run_file = "motd.cf"
133+
# end
134+
#
135+
# You can also configure and bootstrap a client to an existing
136+
# policy server:
137+
#
138+
# config.vm.provision "cfengine" do |cf|
139+
# cf.policy_server_address = "10.0.2.15"
140+
# end
141+
142+
# Enable provisioning with Puppet stand alone. Puppet manifests
143+
# are contained in a directory path relative to this Vagrantfile.
144+
# You will need to create the manifests directory and a manifest in
145+
# the file default.pp in the manifests_path directory.
146+
#
147+
# config.vm.provision "puppet" do |puppet|
148+
# puppet.manifests_path = "manifests"
149+
# puppet.manifest_file = "site.pp"
150+
# end
151+
152+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
153+
# path, and data_bags path (all relative to this Vagrantfile), and adding
154+
# some recipes and/or roles.
155+
#
156+
# config.vm.provision "chef_solo" do |chef|
157+
# chef.cookbooks_path = "../my-recipes/cookbooks"
158+
# chef.roles_path = "../my-recipes/roles"
159+
# chef.data_bags_path = "../my-recipes/data_bags"
160+
# chef.add_recipe "mysql"
161+
# chef.add_role "web"
162+
#
163+
# # You may also specify custom JSON attributes:
164+
# chef.json = { mysql_password: "foo" }
165+
# end
166+
167+
# Enable provisioning with chef server, specifying the chef server URL,
168+
# and the path to the validation key (relative to this Vagrantfile).
169+
#
170+
# The Opscode Platform uses HTTPS. Substitute your organization for
171+
# ORGNAME in the URL and validation key.
172+
#
173+
# If you have your own Chef Server, use the appropriate URL, which may be
174+
# HTTP instead of HTTPS depending on your configuration. Also change the
175+
# validation key to validation.pem.
176+
#
177+
# config.vm.provision "chef_client" do |chef|
178+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
179+
# chef.validation_key_path = "ORGNAME-validator.pem"
180+
# end
181+
#
182+
# If you're using the Opscode platform, your validator client is
183+
# ORGNAME-validator, replacing ORGNAME with your organization name.
184+
#
185+
# If you have your own Chef Server, the default validation client name is
186+
# chef-validator, unless you changed the configuration.
187+
#
188+
# chef.validation_client_name = "ORGNAME-validator"
189+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Please put your systemVM into this location with the name: systemvmtemplate.vhd.bz2
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Please put your tinyVHD image into this location with the name: ce5b212e-215a-3461-94fb-814a635b2215.vhd
2+
Also put the template.properties file for the tinyVHD image into this location.

0 commit comments

Comments
 (0)