forked from sovereign/sovereign
/
Vagrantfile
44 lines (36 loc) · 1.46 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
# If you're having issues, upgrade to Vagrant 1.3.x. It generates an inventory automatically:
# https://github.com/mitchellh/vagrant/blob/master/CHANGELOG.md#130-september-5-2013
Vagrant.configure('2') do |config|
config.vm.provider :lxc do |lxc, override|
override.vm.box = 'precise64'
override.vm.box_url = 'http://bit.ly/vagrant-lxc-precise64-2013-05-08'
end
config.vm.provider :virtualbox do |vbox, override|
override.vm.box = 'precise64'
override.vm.box_url = 'http://files.vagrantup.com/precise64.box'
end
boxes = [
{
:name => 'ansible.local',
:forwards => { 22 => 22222,
80 => 80,
25 => 25,
143 => 143,
465 => 465,
993 => 993 }
}
]
boxes.each do |opts|
config.vm.hostname = opts[:name]
opts[:forwards].each do |guest_port, host_port|
config.vm.network :forwarded_port, :guest => guest_port, :host => host_port
end
config.vm.provision :shell,
:inline => 'if [ ! -e /root/apt.updated ]; then apt-get update && touch /root/apt.updated ; fi; apt-get install -y python-apt'
config.vm.provision :ansible do |ansible|
ansible.playbook = 'site.yml'
end
config.vm.provision :shell,
:inline => "echo [test] > /vagrant/hosts.autogen && ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | cut -d: -f2 >> /vagrant/hosts.autogen"
end
end