-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathVagrantfile
56 lines (42 loc) · 1.72 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
Vagrant.configure("2") do |config|
# main & default: normal OS series...
config.vm.define "main", primary: true do |node|
node.vm.box = "ubuntu/trusty64"
node.vm.network "private_network", ip: "10.0.0.10"
node.vm.provision "ansible" do |ansible|
ansible.playbook = "wordpress.yml"
ansible.sudo = true
end
node.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "256"]
end
end
config.vm.define "db" do |node|
node.vm.box = "ubuntu/trusty64"
node.vm.network "private_network", ip: "10.0.0.20"
node.vm.provision "ansible" do |ansible|
ansible.playbook = "db.yml"
ansible.sudo = true
end
node.vm.provider "virtualbox" do |vb|
##vb.customize ["modifyvm", :id, "--memory", "256"]
end
end
# docker: for auto build & testing (e.g., Travis CI)
config.vm.define "docker" do |node|
node.vm.box = "williamyeh/ubuntu-trusty64-docker"
node.vm.provision "shell", inline: <<-SHELL
cd /vagrant
docker build -f test/Dockerfile-db -t db .
docker build -f test/Dockerfile-wordpress -t wordpress .
docker run -d --name db db
sleep 60
docker run -d --name wordpress --link db:MYSQL_ADDRESS wordpress
sleep 300
IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' wordpress) ; echo http://$IP:80/ > url
cat url | xargs -t -n 1 curl -v -o result-wordpress
echo "==> Validating the test results..."
grep '<title>ANSIBLE_TEST' result-wordpress
SHELL
end
end