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
Vagrantfile
1 1 # -*- mode: ruby -*-
2 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 11 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5 12 VAGRANTFILE_API_VERSION = "2"
6 13  
... ... @@ -10,24 +17,43 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
10 17 # please see the online documentation at vagrantup.com.
11 18  
12 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 49 # Create a forwarded port mapping which allows access to a specific port
20 50 # within the machine from a port on the host machine. In the example below,
21 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 54 # Create a private network, which allows host-only access to the machine
29 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 58 # Create a public network, which generally matched to bridged network.
33 59 # Bridged networks make the machine appear as another physical device on
... ... @@ -43,40 +69,42 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
43 69 # the path on the guest to mount the folder. And the optional third
44 70 # argument is a set of non-required options.
45 71 # config.vm.synced_folder "../data", "/vagrant_data"
46   - config.vm.synced_folder ".", "/vagrant", type: "nfs"
47 72  
48 73 # Provider-specific configuration so you can fine-tune various
49 74 # backing providers for Vagrant. These expose provider-specific options.
50 75 # Example for VirtualBox:
51 76 #
52   - config.vm.provider "virtualbox" do |vb|
  77 + # config.vm.provider "virtualbox" do |vb|
53 78 # # Don't boot with headless mode
54 79 # vb.gui = true
55 80 #
56 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 85 # View the documentation for the provider you're using for more
61 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 104 # Enable provisioning with Puppet stand alone. Puppet manifests
64 105 # are contained in a directory path relative to this Vagrantfile.
65 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 109 # config.vm.provision "puppet" do |puppet|
82 110 # puppet.manifests_path = "manifests"
... ... @@ -95,7 +123,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
95 123 # chef.add_role "web"
96 124 #
97 125 # # You may also specify custom JSON attributes:
98   - # chef.json = { :mysql_password => "foo" }
  126 + # chef.json = { mysql_password: "foo" }
99 127 # end
100 128  
101 129 # Enable provisioning with chef server, specifying the chef server URL,
... ...