1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- # 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
|