From 203ffcbfc31abb06c306d3adbde7e44dce9afca2 Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Thu, 3 Mar 2016 15:28:30 -0500 Subject: Added support for CentOS and Vagrant Signed-off-by: Larry Smith Jr --- Vagrantfile | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Vagrantfile (limited to 'Vagrantfile') diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..9c68a3d --- /dev/null +++ b/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