| 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 | VAGRANTFILE_API_VERSION = "2"
|
|---|
| 10 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|---|
| 11 | config.nfs.map_uid = Process.uid
|
|---|
| 12 | config.nfs.map_gid = Process.gid
|
|---|
| 13 |
|
|---|
| 14 | config.vbguest.auto_update = true
|
|---|
| 15 | config.vbguest.auto_reboot = true
|
|---|
| 16 | config.vbguest.installer = VagrantVbguest::Installers::RedHat
|
|---|
| 17 | config.ssh.insert_key=true
|
|---|
| 18 |
|
|---|
| 19 | if Vagrant.has_plugin?("vagrant-proxyconf")
|
|---|
| 20 | config.proxy.http = "http://3.187.157.236:9400"
|
|---|
| 21 | config.proxy.https = "http://3.187.157.236:9400"
|
|---|
| 22 | config.proxy.no_proxy = ""
|
|---|
| 23 | config.yum_proxy.http = "http://3.187.157.236:9400"
|
|---|
| 24 | config.proxy.enabled = true
|
|---|
| 25 | end
|
|---|
| 26 | config.vm.define "vb-config-vb-dhcp-server-0" do |dev|
|
|---|
| 27 | dev.vm.box = "config-vb-dhcp-server-0"
|
|---|
| 28 | dev.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/22/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-22-20150521.x86_64.vagrant-virtualbox.box"
|
|---|
| 29 |
|
|---|
| 30 | dev.vm.synced_folder "./guestshared", "/vagrant", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'fsc']
|
|---|
| 31 | #config.bindfs.bind_folder "/vagrant, "./guestshared", :owner => "1001", :group => "1001",
|
|---|
| 32 | # perms: "u=rwx:g=rx:o=rx",
|
|---|
| 33 | # create_as_user: true
|
|---|
| 34 |
|
|---|
| 35 | if Vagrant.has_plugin?("vagrant-cachier")
|
|---|
| 36 | # Configure cached packages to be shared between instances of the same base box.
|
|---|
| 37 | # More info on http://fgrehm.viewdocs.io/vagrant-cachier/usage
|
|---|
| 38 | config.cache.scope = :box
|
|---|
| 39 | config.cache.enable :yum
|
|---|
| 40 |
|
|---|
| 41 | # OPTIONAL: If you are using VirtualBox, you might want to use that to enable
|
|---|
| 42 | # NFS for shared folders. This is also very useful for vagrant-libvirt if you
|
|---|
| 43 | # want bi-directional sync
|
|---|
| 44 | # The nolock option can be useful for an NFSv3 client that wants to avoid the
|
|---|
| 45 | # NLM sideband protocol. Without this option, apt-get might hang if it tries
|
|---|
| 46 | # to lock files needed for /var/cache/* operations. All of this can be avoided
|
|---|
| 47 | # by using NFSv4 everywhere. Please note that the tcp option is not the default.
|
|---|
| 48 |
|
|---|
| 49 | config.cache.synced_folder_opts={ type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'nolock'] }
|
|---|
| 50 | end
|
|---|
| 51 |
|
|---|
| 52 | # Should be automatic in ideal world. See to vb.customize.
|
|---|
| 53 | # dev.vm.base_mac = "080027429590"
|
|---|
| 54 | ## dev.vm.network :private_network, type: :dhcp
|
|---|
| 55 | config.vm.network "private_network",ip: "192.168.56.2"
|
|---|
| 56 |
|
|---|
| 57 | # Example for VirtualBox:
|
|---|
| 58 | dev.vm.provider :virtualbox do |vb|
|
|---|
| 59 | # Display the VirtualBox GUI when booting the machine
|
|---|
| 60 | # for desktop:
|
|---|
| 61 | host = RbConfig::CONFIG['host_os']
|
|---|
| 62 |
|
|---|
| 63 | # Give VM 1/4 system memory & access to all cpu cores on the host
|
|---|
| 64 | if host =~ /darwin/
|
|---|
| 65 | cpus = `sysctl -n hw.ncpu`.to_i
|
|---|
| 66 | # sysctl returns Bytes and we need to convert to MB
|
|---|
| 67 | mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
|
|---|
| 68 | elsif host =~ /linux/
|
|---|
| 69 | cpus = `nproc`.to_i
|
|---|
| 70 | # meminfo shows KB and we need to convert to MB
|
|---|
| 71 | mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
|
|---|
| 72 | elsif host =~ /cygwin/
|
|---|
| 73 | cpus = `nproc`.to_i
|
|---|
| 74 | # meminfo shows KB and we need to convert to MB
|
|---|
| 75 | mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
|
|---|
| 76 | else # sorry other folks, I can't help you
|
|---|
| 77 | cpus = 2
|
|---|
| 78 | mem = 1024
|
|---|
| 79 | end
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 | vb.customize ["modifyvm", :id, "--accelerate3d", "off"]
|
|---|
| 84 | vb.gui=false
|
|---|
| 85 |
|
|---|
| 86 | vb.customize ["modifyvm", :id, "--memory", mem]
|
|---|
| 87 | vb.customize ["modifyvm", :id, "--cpus", cpus]
|
|---|
| 88 | # Customize the amount of memory on the VM:
|
|---|
| 89 | vb.name = "vb-config-vb-dhcp-server-0"
|
|---|
| 90 | # If vboxnet0 is present - it should create new vboxnet1
|
|---|
| 91 | ## vb.customize ["modifyvm", "vb-config-vb-dhcp-server-0", "--hostonlyadapter2", "vboxnet0"]
|
|---|
| 92 | vb.customize ["modifyvm", :id, "--hostonlyadapter2", "VirtualBox Host-Only Ethernet Adapter"]
|
|---|
| 93 |
|
|---|
| 94 | end
|
|---|
| 95 |
|
|---|
| 96 | config.vm.provision :shell, inline: "if [[ \"/vagrant\" != \"/vagrant\" ]]; then sudo cp -rvf /vagrant/provision /vagrant/; fi"
|
|---|
| 97 | config.vm.provision :shell, inline: "/bin/bash -x /vagrant/provision/init.sh vagrant LOGON+212428289 1>/var/log/provision.log 2>&1"
|
|---|
| 98 |
|
|---|
| 99 | end
|
|---|
| 100 | end
|
|---|
| 101 |
|
|---|