jasonbin

vagrantup with additional hard disk

Dec 26th, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.52 KB | None | 0 0
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3.  
  4. # All Vagrant configuration is done below. The "2" in Vagrant.configure
  5. # configures the configuration version (we support older styles for
  6. # backwards compatibility). Please don't change it unless you know what
  7. # you're doing.
  8. #
  9. #
  10. file_to_disk = 'www.vdi'
  11.  
  12. Vagrant.configure("2") do |config|
  13.   # The most common configuration options are documented and commented below.
  14.   # For a complete reference, please see the online documentation at
  15.   # https://docs.vagrantup.com.
  16.  
  17.   # Every Vagrant development environment requires a box. You can search for
  18.   # boxes at https://atlas.hashicorp.com/search.
  19.   config.vm.box = "ubuntu/trusty64"
  20.  
  21.   # Disable automatic box update checking. If you disable this, then
  22.   # boxes will only be checked for updates when the user runs
  23.   # `vagrant box outdated`. This is not recommended.
  24.   # config.vm.box_check_update = false
  25.  
  26.   # Create a forwarded port mapping which allows access to a specific port
  27.   # within the machine from a port on the host machine. In the example below,
  28.   # accessing "localhost:8080" will access port 80 on the guest machine.
  29.   # config.vm.network "forwarded_port", guest: 80, host: 8080
  30.  
  31.   # Create a private network, which allows host-only access to the machine
  32.   # using a specific IP.
  33.   # config.vm.network "private_network", ip: "192.168.33.10"
  34.  
  35.   # Create a public network, which generally matched to bridged network.
  36.   # Bridged networks make the machine appear as another physical device on
  37.   # your network.
  38.   # config.vm.network "public_network"
  39.  
  40.   # Share an additional folder to the guest VM. The first argument is
  41.   # the path on the host to the actual folder. The second argument is
  42.   # the path on the guest to mount the folder. And the optional third
  43.   # argument is a set of non-required options.
  44.   # config.vm.synced_folder "../data", "/vagrant_data"
  45.  
  46.   # Provider-specific configuration so you can fine-tune various
  47.   # backing providers for Vagrant. These expose provider-specific options.
  48.   # Example for VirtualBox:
  49.   #
  50.   # config.vm.provider "virtualbox" do |vb|
  51.   #   # Display the VirtualBox GUI when booting the machine
  52.   #   vb.gui = true
  53.   #
  54.   #   # Customize the amount of memory on the VM:
  55.   #   vb.memory = "1024"
  56.   # end
  57.   #
  58.   # View the documentation for the provider you are using for more
  59.   # information on available options.
  60.  
  61.   # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  62.   # such as FTP and Heroku are also available. See the documentation at
  63.   # https://docs.vagrantup.com/v2/push/atlas.html for more information.
  64.   # config.push.define "atlas" do |push|
  65.   #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  66.   # end
  67.   # Enable provisioning with a shell script. Additional provisioners such as
  68.   # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  69.   # documentation for more information about their specific syntax and use.
  70.   # config.vm.provision "shell", inline: <<-SHELL
  71.   #   apt-get update
  72.   #   apt-get install -y apache2
  73.   # SHELL
  74.  
  75.   config.vm.provider "virtualbox" do |vb|
  76.     vb.name = "cl"
  77.     vb.gui = false
  78.  
  79.   # Customize the amount of memory on the VM:
  80.     vb.memory = "8192"
  81.     vb.cpus = 4
  82.   # Add hard disk
  83.     unless File.exist?(file_to_disk)
  84.       vb.customize ['createhd', '--filename', file_to_disk, '--size', 300 * 1024]
  85.     end
  86.     vb.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
  87.   end
  88.  
  89. end
Advertisement
Add Comment
Please, Sign In to add comment