forked from Silom/vagrant-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
executable file
·46 lines (41 loc) · 1.47 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
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "nodebox-precise"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.synced_folder "project/", "/var/nodespace/project/"
config.vm.synced_folder "resources/", "/var/nodespace/resources/"
config.vm.hostname = "nodebox"
config.vm.network :private_network, ip: "192.168.101.101"
# This shell script is based on mss redmine setup repository, big thanks for that. (https://github.com/mss/vagrant-ansible-redmine)
config.vm.provision "shell" do |shell|
shell.args = "setup/vagrant.yml"
shell.inline = <<-end
#!/bin/bash
ppa=
while getopts p OPTNAME; do
case "$OPTNAME" in
p)
ppa=ppa:rquillo/ansible
;;
*)
exit 1
;;
esac
done
shift $((OPTIND - 1))
playbook=${1:-playbook.yml}
set -ex
sed -i -e "/ $(lsb_release -cs)-backports /s/^# *//" /etc/apt/sources.list
if [ -n "$ppa" ]; then
if ! dpkg -s python-software-properties 2>/dev/null | grep -q '^Status:.* installed'; then
apt-get update
apt-get install -y python-software-properties
fi
apt-add-repository -y $ppa
fi
apt-get update
apt-get install -y ansible
ansible-playbook /vagrant/$playbook -v -c local -i /etc/hostname
end
end
end