No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Vagrantfile 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # The following patch needs to be applied for ansible to run cleanly on vagrant up:
  2. # https://github.com/mitchellh/vagrant/pull/1723.diff on /opt/vagrant/embedded/gems/gems/vagrant-1.2.x
  3. #
  4. # Or just use Vagrant 1.3.x: it generates an inventory automatically
  5. # (https://github.com/mitchellh/vagrant/blob/master/CHANGELOG.md#130-september-5-2013)
  6. Vagrant.configure('2') do |config|
  7. config.vm.provider :lxc do |lxc, override|
  8. override.vm.box = 'precise64'
  9. override.vm.box_url = 'http://bit.ly/vagrant-lxc-precise64-2013-05-08'
  10. end
  11. config.vm.provider :virtualbox do |vbox, override|
  12. override.vm.box = 'precise64'
  13. override.vm.box_url = 'http://files.vagrantup.com/precise64.box'
  14. end
  15. boxes = [
  16. {
  17. :name => 'ansible.local',
  18. :forwards => { 22 => 22222,
  19. 80 => 80,
  20. 25 => 25,
  21. 143 => 143,
  22. 465 => 465,
  23. 993 => 993 }
  24. }
  25. ]
  26. boxes.each do |opts|
  27. config.vm.hostname = opts[:name]
  28. opts[:forwards].each do |guest_port, host_port|
  29. config.vm.network :forwarded_port, :guest => guest_port, :host => host_port
  30. end
  31. config.vm.provision :shell,
  32. :inline => 'if [ ! -e /root/apt.updated ]; then apt-get update && touch /root/apt.updated ; fi; apt-get install -y python-apt'
  33. config.vm.provision :ansible do |ansible|
  34. ansible.playbook = 'site.yml'
  35. end
  36. config.vm.provision :shell,
  37. :inline => "echo [test] > /vagrant/hosts.autogen && ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | cut -d: -f2 >> /vagrant/hosts.autogen"
  38. end
  39. end