-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathVagrantfile
130 lines (90 loc) · 4.22 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# WARNING: if you are going to run a 64 bit guest inside a 32 bit host
# you must enable hardware virtualization from your BIOS
# Good list of boxes at: http://www.vagrantbox.es/
## vm
## box
# Name of an installed box.
## box_url
# URL at which the box can be found if not installed locally.
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
#config.vm.box = "debian-7.2.0"
#config.vm.box_url = "https://dl.dropboxusercontent.com/u/197673519/debian-7.2.0.box"
# If box is a shorthand for Vagrant Cloud, box_url is not needed.
## hostname
# Will appear on most shells as: vagrant@hostname depending on the PS1 line.
# Good way to determine in which machine you are.
config.vm.hostname = 'HOSTNAME'
## provision
## shell
## priviledged
# Run shell script as root. If you want to run as the vagrant user, use `privileged: false`,
# Remember from your shell lessons that doint `sudo su user` does not work inside a script:
# http://stackoverflow.com/questions/16768777/can-i-switch-user-in-vagrant-bootstrap-shell-script
# Cleanest solution without privileged: make a separate sh file, and `sudo bash file.sh`.
# Multiple methods can be specified. All are run.
config.vm.provision :shell, inline: "date > /tmp/provision0"
config.vm.provision :shell, inline: "date > /tmp/provision1"
config.vm.provision :shell, inline: <<EOF
date > /tmp/provision_multiline
EOF
# Common combo with priviledged false: set initial directory to `/vagrant`.
config.vm.provision :shell, privileged: false, inline: <<EOF
#!/usr/bin/env bash
echo 'cd /vagrant' >> ~/.bashrc
EOF
# From script;
#config.vm.provision :shell, :path => 'script.sh'
# We recommend that you start your script with `set -v`, which will print the commands before executing them,
# so you can understand what is being installed at each point.
# **IMPORTANT**: copy pasting commands in SSH does not mean they will work from a non interactive terminal,
# which will run a non interactive shell. In particular, beware of any sourcing of files like `~/.bashrc`
# or `~/.rvm/scripts/rvm`.
## cores ##memory
# Provider dependant options.
name = 'vagrant_test'
memory = '512'
# WARNING: if you use more than one CPU on the guest
# you must enable hardware virtualization from your BIOS
cpus = '1'
config.vm.provider "virtualbox" do |v|
v.customize [
'modifyvm', :id,
# Appears on the virtualbox GUI. Can be changed anytime.
'--name', name,
'--memory', memory,
'--cpus', cpus
]
if cpus.to_i > 1
v.customize ["modifyvm", :id, "--ioapic", "on"]
end
end
#config.vm.provider :vmware_fusion do |v, override|
#override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
#v.vmx["memsize"] = memory
#v.vmx["numvcpus"] = cpus
#if cpus.to_i > 1
#v.customize ["modifyvm", :id, "--ioapic", "on"]
#end
#end
## bindfs plugin
#config.vm.provision :shell, :inline => <<EOF
#mkdir /bindfs
#EOF
#config.bindfs.bind_folder "/nfs", "/bindfs", :owner => "1111", :group => "1111", :'create-as-user' => true, :perms => "u=rwx:g=rwx:o=rwx", :'create-with-perms' => "u=rwx:g=rwx:o=rwx", :'chown-ignore' => true, :'chgrp-ignore' => true, :'chmod-ignore' => true
# Use NFS because it is faster, but also change permissions which NFS does not normally allow.
# Must have a hostonly network address for this to work.
#config.vm.network :hostonly, "192.168.50.4"
# Disable default mapping from . to /vagrant:
#config.vm.synced_folder ".", "/vagrant", :disabled => true
# Create a fast NFS share directory
#config.vm.synced_folder ".", "/nfs", :nfs => true
# All Vagrant configuration is done here. The most common configuration
end
# Multiple config blocks are all run.
Vagrant.configure("2") do |config|
config.vm.provision :shell, :inline => "date > /tmp/second_block"
end