forked from cloudfoundry/bosh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
102 lines (85 loc) · 3.96 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
env = ENV.to_hash
vm_box = 'bosh-stemcell-937f30'
Vagrant.configure('2') do |config|
config.vm.box = vm_box
config.ssh.username = 'ubuntu'
config.vm.define :local do |local|
local.vm.box_url = "https://bosh-jenkins-artifacts.s3.amazonaws.com/bosh-vagrant-boxes/#{vm_box}-virtualbox.box"
local.vm.provider :virtualbox do |virtualbox|
virtualbox.customize ['modifyvm', :id, '--cpus', '2']
virtualbox.customize ['modifyvm', :id, '--memory', '2048']
end
end
config.vm.define :remote do |remote|
remote.vm.box_url = "https://bosh-jenkins-artifacts.s3.amazonaws.com/bosh-vagrant-boxes/#{vm_box}-aws.box"
remote.vm.provider :aws do |aws, override|
aws.instance_type = 'm3.xlarge'
aws.instance_ready_timeout = 600
aws.ami = 'placeholder to keep vagrant_aws_plugin happy'
aws.access_key_id = env.fetch('BOSH_AWS_ACCESS_KEY_ID')
aws.secret_access_key = env.fetch('BOSH_AWS_SECRET_ACCESS_KEY')
aws.tags = { 'Name' => vm_box }
aws.keypair_name = env.fetch('BOSH_KEYPAIR_NAME', 'bosh')
if env['BOSH_AWS_SUBNET_ID']
aws.associate_public_ip = true
aws.subnet_id = env.fetch('BOSH_AWS_SUBNET_ID')
aws.security_groups = [env.fetch('BOSH_AWS_SECURITY_GROUP')]
else
aws.security_groups = ['bosh-stemcell']
end
override.ssh.username = 'ubuntu'
override.ssh.private_key_path = env.fetch('BOSH_VAGRANT_KEY_PATH', '~/.ssh/id_rsa_bosh')
override.nfs.functional = false
end
end
config.vm.provision :shell do |shell|
shell.inline = <<-BASH
cat > /etc/apt/sources.list <<EOS
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
EOS
rm -rf /etc/apt/sources.list.d/multiverse-trusty*
apt-get -y update
BASH
end
config.vm.provision :shell do |shell|
shell.inline = <<-BASH
mkdir -p /mnt/tmp
chown -R ubuntu:ubuntu /mnt/tmp
echo >> /home/ubuntu/.profile
echo 'export TMPDIR=/mnt/tmp' >> /home/ubuntu/.profile
mkdir -p /mnt/stemcells
chown -R ubuntu:ubuntu /mnt/stemcells
mkdir -p /bosh/tmp
chown -R ubuntu:ubuntu /bosh
gem install bundler --version 1.11.2 --no-ri --no-rdoc
( cd /bosh && bundle install --local )
wget -q https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz
echo 46eecd290d8803887dec718c691cc243f2175fe0 go*.tar.gz | sha1sum -c -
tar -C /usr/local -xzf go*.tar.gz
rm go*.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> /home/ubuntu/.profile
BASH
end
config.vm.synced_folder '../.', '/bosh', rsync__args: ["--verbose", "--archive", "--delete", "-z"]
config.vm.synced_folder '../.git', '/bosh/.git'
end