Commit 24b89caf251a0fe7ca7156f4bb700b163c568eca

Authored by Lucas Kanashiro
1 parent e84c7725

Updating Vagrantfile to select distro's VM

Showing 1 changed file with 57 additions and 29 deletions   Show diff stats
1 # -*- mode: ruby -*- 1 # -*- mode: ruby -*-
2 # vi: set ft=ruby : 2 # vi: set ft=ruby :
3 3
  4 +# CHOOSE THE DISTRO FOR COLAB VM (set the distro variable):
  5 +# - ubuntu_precise
  6 +# - ubuntu_trusty
  7 +# - centos_65
  8 +
  9 +distro = "centos_65"
  10 +
4 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 11 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5 VAGRANTFILE_API_VERSION = "2" 12 VAGRANTFILE_API_VERSION = "2"
6 13
@@ -10,24 +17,43 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| @@ -10,24 +17,43 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
10 # please see the online documentation at vagrantup.com. 17 # please see the online documentation at vagrantup.com.
11 18
12 # Every Vagrant virtual environment requires a box to build off of. 19 # Every Vagrant virtual environment requires a box to build off of.
13 - config.vm.box = "trusty64"  
14 20
15 - # The url from where the 'config.vm.box' box will be fetched if it  
16 - # doesn't already exist on the user's system.  
17 - config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" 21 + config.vm.define "colab" do |colab|
  22 +
  23 + colab.vm.box = distro
  24 +
  25 + if distro == "ubuntu_precise"
  26 + puts "Installing Ubuntu Precise VM!"
  27 + colab.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
  28 + elsif distro == "ubuntu_trusty"
  29 + puts "Installing Ubuntu Trusty VM!"
  30 + colab.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
  31 + elsif distro == "centos_65"
  32 + puts "Installing CentOS 6.5 VM!"
  33 + colab.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box"
  34 + end
  35 +
  36 + colab.vm.network "forwarded_port", guest: 80, host: 80
  37 + colab.vm.network "private_network", ip: "192.168.33.10"
  38 + colab.vm.provider "virtualbox" do |vb|
  39 + # Use VBoxManage to customize the VM. For example to change memory:
  40 + vb.customize ["modifyvm", :id, "--memory", "1024"]
  41 + end
  42 + end
  43 +
  44 + # Disable automatic box update checking. If you disable this, then
  45 + # boxes will only be checked for updates when the user runs
  46 + # `vagrant box outdated`. This is not recommended.
  47 + # config.vm.box_check_update = false
18 48
19 # Create a forwarded port mapping which allows access to a specific port 49 # Create a forwarded port mapping which allows access to a specific port
20 # within the machine from a port on the host machine. In the example below, 50 # within the machine from a port on the host machine. In the example below,
21 # accessing "localhost:8080" will access port 80 on the guest machine. 51 # accessing "localhost:8080" will access port 80 on the guest machine.
22 - config.vm.network :forwarded_port, guest: 80, host: 8080  
23 - config.vm.network :forwarded_port, guest: 8000, host: 8000  
24 - config.vm.network :forwarded_port, guest: 5280, host: 5280  
25 - config.vm.network :forwarded_port, guest: 8080, host: 8081  
26 - config.vm.network :forwarded_port, guest: 8983, host: 8983 52 + # config.vm.network "forwarded_port", guest: 80, host: 8080
27 53
28 # Create a private network, which allows host-only access to the machine 54 # Create a private network, which allows host-only access to the machine
29 # using a specific IP. 55 # using a specific IP.
30 - config.vm.network "private_network", ip: "192.168.33.10" 56 + # config.vm.network "private_network", ip: "192.168.33.10"
31 57
32 # Create a public network, which generally matched to bridged network. 58 # Create a public network, which generally matched to bridged network.
33 # Bridged networks make the machine appear as another physical device on 59 # Bridged networks make the machine appear as another physical device on
@@ -43,40 +69,42 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| @@ -43,40 +69,42 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
43 # the path on the guest to mount the folder. And the optional third 69 # the path on the guest to mount the folder. And the optional third
44 # argument is a set of non-required options. 70 # argument is a set of non-required options.
45 # config.vm.synced_folder "../data", "/vagrant_data" 71 # config.vm.synced_folder "../data", "/vagrant_data"
46 - config.vm.synced_folder ".", "/vagrant", type: "nfs"  
47 72
48 # Provider-specific configuration so you can fine-tune various 73 # Provider-specific configuration so you can fine-tune various
49 # backing providers for Vagrant. These expose provider-specific options. 74 # backing providers for Vagrant. These expose provider-specific options.
50 # Example for VirtualBox: 75 # Example for VirtualBox:
51 # 76 #
52 - config.vm.provider "virtualbox" do |vb| 77 + # config.vm.provider "virtualbox" do |vb|
53 # # Don't boot with headless mode 78 # # Don't boot with headless mode
54 # vb.gui = true 79 # vb.gui = true
55 # 80 #
56 # # Use VBoxManage to customize the VM. For example to change memory: 81 # # Use VBoxManage to customize the VM. For example to change memory:
57 - vb.customize ["modifyvm", :id, "--memory", "1024"]  
58 - end 82 + # vb.customize ["modifyvm", :id, "--memory", "1024"]
  83 + # end
59 # 84 #
60 # View the documentation for the provider you're using for more 85 # View the documentation for the provider you're using for more
61 # information on available options. 86 # information on available options.
62 87
  88 + # Enable provisioning with CFEngine. CFEngine Community packages are
  89 + # automatically installed. For example, configure the host as a
  90 + # policy server and optionally a policy file to run:
  91 + #
  92 + # config.vm.provision "cfengine" do |cf|
  93 + # cf.am_policy_hub = true
  94 + # # cf.run_file = "motd.cf"
  95 + # end
  96 + #
  97 + # You can also configure and bootstrap a client to an existing
  98 + # policy server:
  99 + #
  100 + # config.vm.provision "cfengine" do |cf|
  101 + # cf.policy_server_address = "10.0.2.15"
  102 + # end
  103 +
63 # Enable provisioning with Puppet stand alone. Puppet manifests 104 # Enable provisioning with Puppet stand alone. Puppet manifests
64 # are contained in a directory path relative to this Vagrantfile. 105 # are contained in a directory path relative to this Vagrantfile.
65 # You will need to create the manifests directory and a manifest in 106 # You will need to create the manifests directory and a manifest in
66 - # the file base.pp in the manifests_path directory.  
67 - #  
68 - # An example Puppet manifest to provision the message of the day:  
69 - #  
70 - # # group { "puppet":  
71 - # # ensure => "present",  
72 - # # }  
73 - # #  
74 - # # File { owner => 0, group => 0, mode => 0644 }  
75 - # #  
76 - # # file { '/etc/motd':  
77 - # # content => "Welcome to your Vagrant-built virtual machine!  
78 - # # Managed by Puppet.\n"  
79 - # # } 107 + # the file default.pp in the manifests_path directory.
80 # 108 #
81 # config.vm.provision "puppet" do |puppet| 109 # config.vm.provision "puppet" do |puppet|
82 # puppet.manifests_path = "manifests" 110 # puppet.manifests_path = "manifests"
@@ -95,7 +123,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| @@ -95,7 +123,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
95 # chef.add_role "web" 123 # chef.add_role "web"
96 # 124 #
97 # # You may also specify custom JSON attributes: 125 # # You may also specify custom JSON attributes:
98 - # chef.json = { :mysql_password => "foo" } 126 + # chef.json = { mysql_password: "foo" }
99 # end 127 # end
100 128
101 # Enable provisioning with chef server, specifying the chef server URL, 129 # Enable provisioning with chef server, specifying the chef server URL,