4 # All Vagrant configuration is done below. The "2" in Vagrant.configure
5 # configures the configuration version (we support older styles for
6 # backwards compatibility). Please don't change it unless you know what
8 Vagrant.configure(2) do |config|
9 #Define if running desktop OS to yes otherwise no
11 #Define the number of nodes to spin up
15 (1..N).each do |node_id|
18 config.vm.define "node#{nid}" do |node|
19 node.vm.box = "mrlesmithjr/centos-7"
20 node.vm.provider "virtualbox" do |vb|
25 vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxvga"]
26 vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
27 vb.customize ["modifyvm", :id, "--ioapic", "on"]
28 vb.customize ["modifyvm", :id, "--vram", "128"]
29 vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
32 node.vm.hostname = "node#{nid}"
33 ### Define additional network adapters below
34 node.vm.network :private_network, ip: "192.168.202.#{200 + nid}"
36 ### Define port forwards below
37 # node.vm.network "forwarded_port", guest: 80, host: "#{8080 + nid}"
38 # node.vm.network "forwarded_port", guest: 3000, host: "#{3000 + nid}"
41 node.vm.provision :shell, path: "bootstrap.sh", keep_color: "true" #runs initial shell script
42 node.vm.provision "ansible" do |ansible| #runs bootstrap Ansible playbook
44 ansible.playbook = "bootstrap.yml"
46 node.vm.provision "ansible" do |ansible| #runs Ansible playbook for installing roles/executing tasks
48 ansible.playbook = "playbook.yml"