tyrion

Vagrantfile

Nov 7th, 2013
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.53 KB | None | 0 0
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3.  
  4.  
  5. class DockerInstaller < VagrantVbguest::Installers::Linux
  6.  
  7.   def self.match?(vm)
  8.     :ubuntu == self.distro(vm)
  9.   end
  10.  
  11.   def install(opts=nil, &block)
  12.     remove_packaged_additions(opts=nil, &block)
  13.  
  14.     communicate.sudo('apt-get update', opts, &block)
  15.     communicate.sudo("apt-get -y install #{dependencies}", opts, &block)
  16.  
  17.     super
  18.   end
  19.  
  20.   def dependencies()
  21.     "linux-image-generic-lts-raring linux-headers-generic-lts-raring dkms"
  22.   end
  23.  
  24.   def remove_packaged_additions(opts=nil, &block)
  25.     options = (opts || {}).merge(:error_check => false)
  26.     command = "dpkg --list | grep virtualbox-guest && apt-get -y -q purge virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11"
  27.     communicate.sudo(command, options, &block)
  28.   end
  29.  
  30. end
  31.  
  32. #API/syntax version. Don't touch unless you know what you're doing!
  33. VAGRANTFILE_API_VERSION = "2"
  34.  
  35. Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  36.   # All Vagrant configuration is done here. The most common configuration
  37.   # options are documented and commented below. For a complete reference,
  38.   # please see the online documentation at vagrantup.com.
  39.  
  40.   # Every Vagrant virtual environment requires a box to build off of.
  41.   config.vm.box = "ubuntu"
  42.  
  43.   # The url from where the 'config.vm.box' box will be fetched if it
  44.   # doesn't already exist on the user's system.
  45.   config.vm.box_url = "http://files.vagrantup.com/precise64.box"
  46.  
  47.   # Create a forwarded port mapping which allows access to a specific port
  48.   # within the machine from a port on the host machine. In the example below,
  49.   # accessing "localhost:8080" will access port 80 on the guest machine.
  50.   config.vm.network :forwarded_port, guest: 80, host: 8080
  51.   #config.vm.provision :shell, :path => "bin/bootstrap.sh"
  52.   config.vm.synced_folder ".", "/vagrant", nfs: true
  53.  
  54.  
  55.   # Create a private network, which allows host-only access to the machine
  56.   # using a specific IP.
  57.   config.vm.network :private_network, ip: "192.168.33.10"
  58.   #config.vbguest.installer = DockerInstaller
  59.  
  60.   # Create a public network, which generally matched to bridged network.
  61.   # Bridged networks make the machine appear as another physical device on
  62.   # your network.
  63.   # config.vm.network :public_network
  64.  
  65.   # If true, then any SSH connections made will enable agent forwarding.
  66.   # Default value: false
  67.   # config.ssh.forward_agent = true
  68.  
  69.   # Share an additional folder to the guest VM. The first argument is
  70.   # the path on the host to the actual folder. The second argument is
  71.   # the path on the guest to mount the folder. And the optional third
  72.   # argument is a set of non-required options.
  73.   # config.vm.synced_folder "../data", "/vagrant_data"
  74.  
  75.   # Provider-specific configuration so you can fine-tune various
  76.   # backing providers for Vagrant. These expose provider-specific options.
  77.   # Example for VirtualBox:
  78.   #
  79.   # config.vm.provider :virtualbox do |vb|
  80.   #   # Don't boot with headless mode
  81.   #   vb.gui = true
  82.   #
  83.   #   # Use VBoxManage to customize the VM. For example to change memory:
  84.   #   vb.customize ["modifyvm", :id, "--memory", "1024"]
  85.   # end
  86.   #
  87.   # View the documentation for the provider you're using for more
  88.   # information on available options.
  89.  
  90.   # Enable provisioning with Puppet stand alone.  Puppet manifests
  91.   # are contained in a directory path relative to this Vagrantfile.
  92.   # You will need to create the manifests directory and a manifest in
  93.   # the file precise32.pp in the manifests_path directory.
  94.   #
  95.   # An example Puppet manifest to provision the message of the day:
  96.   #
  97.   # # group { "puppet":
  98.   # #   ensure => "present",
  99.   # # }
  100.   # #
  101.   # # File { owner => 0, group => 0, mode => 0644 }
  102.   # #
  103.   # # file { '/etc/motd':
  104.   # #   content => "Welcome to your Vagrant-built virtual machine!
  105.   # #               Managed by Puppet.\n"
  106.   # # }
  107.   #
  108.   # config.vm.provision :puppet do |puppet|
  109.   #   puppet.manifests_path = "manifests"
  110.   #   puppet.manifest_file  = "site.pp"
  111.   # end
  112.  
  113.   # Enable provisioning with chef solo, specifying a cookbooks path, roles
  114.   # path, and data_bags path (all relative to this Vagrantfile), and adding
  115.   # some recipes and/or roles.
  116.   #
  117.   # config.vm.provision :chef_solo do |chef|
  118.   #   chef.cookbooks_path = "../my-recipes/cookbooks"
  119.   #   chef.roles_path = "../my-recipes/roles"
  120.   #   chef.data_bags_path = "../my-recipes/data_bags"
  121.   #   chef.add_recipe "mysql"
  122.   #   chef.add_role "web"
  123.   #
  124.   #   # You may also specify custom JSON attributes:
  125.   #   chef.json = { :mysql_password => "foo" }
  126.   # end
  127.  
  128.   # Enable provisioning with chef server, specifying the chef server URL,
  129.   # and the path to the validation key (relative to this Vagrantfile).
  130.   #
  131.   # The Opscode Platform uses HTTPS. Substitute your organization for
  132.   # ORGNAME in the URL and validation key.
  133.   #
  134.   # If you have your own Chef Server, use the appropriate URL, which may be
  135.   # HTTP instead of HTTPS depending on your configuration. Also change the
  136.   # validation key to validation.pem.
  137.   #
  138.   # config.vm.provision :chef_client do |chef|
  139.   #   chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
  140.   #   chef.validation_key_path = "ORGNAME-validator.pem"
  141.   # end
  142.   #
  143.   # If you're using the Opscode platform, your validator client is
  144.   # ORGNAME-validator, replacing ORGNAME with your organization name.
  145.   #
  146.   # If you have your own Chef Server, the default validation client name is
  147.   # chef-validator, unless you changed the configuration.
  148.   #
  149.   #   chef.validation_client_name = "ORGNAME-validator"
  150. end
Advertisement
Add Comment
Please, Sign In to add comment