From 380937f5a194505fe802e95e2b73f6970a8effd7 Mon Sep 17 00:00:00 2001
From: Michael Krotscheck <krotscheck@gmail.com>
Date: Thu, 19 Feb 2015 09:50:33 -0800
Subject: [PATCH] Added a Vagrant module and manifest for easier development.

Vagrant file will provision the configuration it finds in vagrant.pp.
Node configurations for precise and trusty provided, on different IP
addresses.

Change-Id: I7b08ce4cc5acdc2ad58261f4872ba2df2e06dcf4
---
 .gitignore  |  1 +
 Vagrantfile | 45 +++++++++++++++++++++++++++++++++++++++++++++
 vagrant.pp  | 15 +++++++++++++++
 vagrant.sh  | 35 +++++++++++++++++++++++++++++++++++
 4 files changed, 96 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Vagrantfile
 create mode 100644 vagrant.pp
 create mode 100644 vagrant.sh

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..997ca2f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.vagrant
\ No newline at end of file
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644
index 0000000..87e6736
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,45 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+
+  # Create an ubuntu/precise box against which we can run our module.
+  config.vm.define "precise" do |precise|
+    # Define the box.
+    precise.vm.box = "ubuntu/precise64"
+    precise.vm.hostname = "puppet-storyboard-precise64"
+
+    config.vm.provider :virtualbox do |vb|
+      vb.customize ['modifyvm', :id,'--memory', '2048']
+      vb.name = 'puppet-storyboard-precise64'
+    end
+
+    # Grant a private IP
+    precise.vm.network "private_network", ip: "192.168.99.22"
+  end
+
+  # Create an ubuntu/trusty box against which we can run our module.
+  config.vm.define "trusty" do |trusty|
+    # Define the box.
+    trusty.vm.box = "ubuntu/trusty64"
+    trusty.vm.hostname = "puppet-storyboard-trusty64"
+
+    config.vm.provider :virtualbox do |vb|
+      vb.customize ['modifyvm', :id,'--memory', '2048']
+      vb.name = 'puppet-storyboard-trusty64'
+    end
+
+    # Grant a private IP
+    trusty.vm.network "private_network", ip: "192.168.99.23"
+  end
+
+  # All VM's run the same provisioning
+  config.vm.provision "shell", path: "vagrant.sh"
+  config.vm.provision "puppet" do |puppet|
+    puppet.manifests_path = ['vm', "/vagrant"]
+    puppet.manifest_file = "vagrant.pp"
+  end
+end
diff --git a/vagrant.pp b/vagrant.pp
new file mode 100644
index 0000000..b11ee64
--- /dev/null
+++ b/vagrant.pp
@@ -0,0 +1,15 @@
+node 'puppet-storyboard-precise64' {
+  class { 'storyboard':
+    mysql_user_password    => 'storyboard',
+    rabbitmq_user_password => 'storyboard',
+    hostname               => '192.168.99.22',
+  }
+}
+
+node 'puppet-storyboard-trusty64' {
+  class { 'storyboard':
+    mysql_user_password    => 'storyboard',
+    rabbitmq_user_password => 'storyboard',
+    hostname               => '192.168.99.23',
+  }
+}
\ No newline at end of file
diff --git a/vagrant.sh b/vagrant.sh
new file mode 100644
index 0000000..af5dd3c
--- /dev/null
+++ b/vagrant.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Install Puppet!
+if [ ! -f /etc/apt/sources.list.d/puppetlabs.list ]; then
+  lsbdistcodename=`lsb_release -c -s`
+  wget https://apt.puppetlabs.com/puppetlabs-release-${lsbdistcodename}.deb
+  sudo dpkg -i puppetlabs-release-${lsbdistcodename}.deb
+  sudo apt-get update
+  sudo apt-get dist-upgrade -y
+fi
+
+if [ ! -d /etc/puppet/modules/stdlib ]; then
+  puppet module install puppetlabs-stdlib --version 3.2.0
+fi
+if [ ! -d /etc/puppet/modules/mysql ]; then
+  puppet module install puppetlabs-mysql --version 0.6.1
+fi
+if [ ! -d /etc/puppet/modules/apache ]; then
+  puppet module install puppetlabs-apache --version 0.0.4
+fi
+if [ ! -d /etc/puppet/modules/rabbitmq ]; then
+  puppet module install puppetlabs-rabbitmq --version 5.0.0
+fi
+if [ ! -d /etc/puppet/modules/puppi ]; then
+  puppet module install example42-puppi --version 2.1.9
+fi
+if [ ! -d /etc/puppet/modules/vcsrepo ]; then
+  puppet module install openstackci-vcsrepo --version 0.0.8
+fi
+if [ ! -d /etc/puppet/modules/python ]; then
+  puppet module install stankevich-python --version 1.6.6
+fi
+if [ ! -d /etc/puppet/modules/storyboard ]; then
+  sudo ln -s /vagrant /etc/puppet/modules/storyboard
+fi
\ No newline at end of file