forked from caddy-ansible/caddy-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
49 lines (40 loc) · 1.26 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.define "buster" do |buster|
buster.vm.box = "debian/buster64"
end
config.vm.define "bionic" do |bionic|
bionic.vm.box = "bento/ubuntu-18.04"
end
config.vm.define "focal" do |focal|
focal.vm.box = "bento/ubuntu-20.04"
end
config.vm.define "centos7" do |centos7|
centos7.vm.box = "bento/centos-7.6"
end
config.vm.define "fedora32" do |fedora32|
fedora32.vm.box = "bento/fedora-32"
end
config.vm.provision "ansible" do |ansible|
ansible.playbook = 'tests/playbook.yml'
ansible.verbose = true
end
$script = <<SCRIPT
# curl localhost and get the http response code
while ! curl -Is localhost:2020 -o /dev/null; do
sleep 1 && echo -n .
done
echo
http_code=$(curl --silent --head --output /dev/null -w '%{http_code}' localhost:2020)
case $http_code in
200|404) echo "$http_code | Server running" ;;
000) echo "$http_code | Server not accessible!" >&2 ; exit 1 ;;
*) echo "$http_code | Unknown http response code!" >&2 ; exit 1 ;;
esac
SCRIPT
# Fix 'stdin: is not a tty' error
config.ssh.pty = true
config.vm.provision :shell, inline: $script
config.vm.synced_folder ".", "/vagrant", disabled: true
end