forked from eucalyptus/micro-qa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
50 lines (45 loc) · 1.53 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
options = {
:cores => 1,
:memory => 1536,
}
CENTOS = {
box: "centos",
url: "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130427.box"
}
OS = CENTOS
$deploy = <<DEPLOY
#!/bin/bash
yum install -y python-devel python-setuptools gcc make python-virtualenv java-1.6.0-openjdk.x86_64 git ntp wget unzip
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
yum install -y jenkins
chkconfig jenkins on
chkconfig ntpd on
service ntpd start
ntpdate -u pool.ntp.org
iptables -F
iptables -F -t nat
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables-save > /etc/sysconfig/iptables
rsync -va /vagrant/ /var/lib/jenkins/
chown -R jenkins:jenkins /var/lib/jenkins
service jenkins start
SYNC_COMMAND=/usr/bin/jenkins-sync
cat > $SYNC_COMMAND <<EOF
#!/bin/bash
rsync -va /var/lib/jenkins/ /vagrant/jenkins/ --exclude workspace --exclude builds --exclude nextBuildNumber --exclude lastStable --exclude lastSuccessful --exclude .git
EOF
chmod +x $SYNC_COMMAND
DEPLOY
Vagrant.configure("2") do |config|
config.vm.box = OS[:box]
config.vm.box_url = OS[:url]
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provider :virtualbox do |v|
v.customize [ "modifyvm", :id, "--memory", options[:memory].to_i, "--cpus", options[:cores].to_i]
end
config.vm.hostname = "micro-qa"
config.vm.provision :shell, :inline => $deploy
end