From 109c6b750751d1c5cd216ad2f09258cf512c4c9e Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Sat, 3 Dec 2016 17:51:25 -0500 Subject: Addressed issue #6 Signed-off-by: Larry Smith Jr --- Vagrant/roles/ansible-rabbitmq/Vagrantfile | 63 ++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Vagrant/roles/ansible-rabbitmq/Vagrantfile (limited to 'Vagrant/roles/ansible-rabbitmq/Vagrantfile') diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrantfile b/Vagrant/roles/ansible-rabbitmq/Vagrantfile new file mode 100644 index 0000000..9c68a3d --- /dev/null +++ b/Vagrant/roles/ansible-rabbitmq/Vagrantfile @@ -0,0 +1,63 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure(2) do |config| + #Define if running desktop OS to yes otherwise no + Desktop = "no" + #Define the number of nodes to spin up + N = 3 + + #Iterate over nodes + (1..N).each do |node_id| + nid = (node_id - 1) + + config.vm.define "node#{nid}" do |node| + node.vm.box = "mrlesmithjr/centos-7" + node.vm.provider "virtualbox" do |vb| + vb.memory = "1024" + vb.cpus = "1" + if Desktop == "yes" + vb.gui = true + vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxvga"] + vb.customize ["modifyvm", :id, "--accelerate3d", "on"] + vb.customize ["modifyvm", :id, "--ioapic", "on"] + vb.customize ["modifyvm", :id, "--vram", "128"] + vb.customize ["modifyvm", :id, "--hwvirtex", "on"] + end + end + node.vm.hostname = "node#{nid}" + ### Define additional network adapters below + node.vm.network :private_network, ip: "192.168.202.#{200 + nid}" + + ### Define port forwards below +# node.vm.network "forwarded_port", guest: 80, host: "#{8080 + nid}" +# node.vm.network "forwarded_port", guest: 3000, host: "#{3000 + nid}" + + if node_id == N + node.vm.provision :shell, path: "bootstrap.sh", keep_color: "true" #runs initial shell script + node.vm.provision "ansible" do |ansible| #runs bootstrap Ansible playbook + ansible.limit = "all" + ansible.playbook = "bootstrap.yml" + end + node.vm.provision "ansible" do |ansible| #runs Ansible playbook for installing roles/executing tasks + ansible.limit = "all" + ansible.playbook = "playbook.yml" + ansible.groups = { + "test-nodes" => [ + "node0", + "node1" + ], + "prod-nodes" => [ + "node2" + ] + } + end + end + + end + end +end -- cgit v1.2.3