Vagrantfile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. Vagrant.configure("2") do |config|
  2. N = 2
  3. box_name = "ARTACK/debian-jessie"
  4. (1..N).each do |machine_id|
  5. config.vm.define "node0#{machine_id}" do |node|
  6. node.vm.box = box_name
  7. node.vm.hostname = "node0#{machine_id}"
  8. node.vm.network "private_network", ip: "192.168.77.#{20+machine_id}"
  9. node.vm.provider :virtualbox do |vb|
  10. vb.customize [
  11. "modifyvm", :id,
  12. "--memory", "128",
  13. ]
  14. end
  15. node.vm.provision :ansible do |ansible|
  16. ansible.playbook = "playbook.yml"
  17. ansible.groups = {
  18. "supernodes" => ["node01", "node02"],
  19. }
  20. end
  21. end
  22. end
  23. U = 1
  24. (1..U).each do |machine_id|
  25. config.vm.define "uplink0#{machine_id}" do |node|
  26. node.vm.box = box_name
  27. node.vm.hostname = "uplink0#{machine_id}"
  28. node.vm.network "private_network", ip: "192.168.77.#{30+machine_id}"
  29. node.vm.provider :virtualbox do |vb|
  30. vb.customize [
  31. "modifyvm", :id,
  32. "--memory", "128",
  33. ]
  34. end
  35. node.vm.provision :ansible do |ansible|
  36. ansible.playbook = "playbook.yml"
  37. ansible.groups = {
  38. "uplinks" => ["uplink01"]
  39. }
  40. end
  41. end
  42. end
  43. config.vm.define "mapserver" do |node|
  44. node.vm.box = box_name
  45. node.vm.hostname = "mapserver"
  46. node.vm.network "private_network", ip: "192.168.77.29"
  47. node.vm.provider :virtualbox do |vb|
  48. vb.customize [
  49. "modifyvm", :id,
  50. "--memory", "128",
  51. ]
  52. end
  53. node.vm.provision :ansible do |ansible|
  54. ansible.playbook = "playbook.yml"
  55. ansible.groups = {
  56. "mapservers" => ["mapserver"]
  57. }
  58. end
  59. end
  60. end