-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVagrantfile
197 lines (168 loc) · 8.1 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# -*- mode: ruby -*-
# vi: set ft=ruby :
vagrant_dir = File.expand_path(File.dirname(__FILE__))
Vagrant.configure("2") do |config|
# Store the current version of Vagrant for use in conditionals when dealing
# with possible backward compatible issues.
vagrant_version = Vagrant::VERSION.sub(/^v/, '')
# Configurations from 1.0.x can be placed in Vagrant 1.1.x specs like the following.
config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", 1024]
v.customize ["modifyvm", :id, "--cpus", 1]
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
# Set the box name in VirtualBox to match the working directory.
vvv_pwd = Dir.pwd
v.name = File.basename(vvv_pwd)
end
# Configuration options for the Parallels provider.
config.vm.provider :parallels do |v|
v.update_guest_tools = true
v.customize ["set", :id, "--longer-battery-life", "off"]
v.memory = 1024
v.cpus = 1
end
# Configuration options for the VMware Fusion provider.
config.vm.provider :vmware_fusion do |v|
v.vmx["memsize"] = "1024"
v.vmx["numvcpus"] = "1"
end
# Configuration options for Hyper-V provider.
config.vm.provider :hyperv do |v, override|
v.memory = 1024
v.cpus = 1
end
# SSH Agent Forwarding
#
# Enable agent forwarding on vagrant ssh commands. This allows you to use ssh keys
# on your host machine inside the guest. See the manual for `ssh-add`.
config.ssh.forward_agent = true
# Default Ubuntu Box
#
# This box is provided by Ubuntu vagrantcloud.com and is a nicely sized (332MB)
# box containing the Ubuntu 14.04 Trusty 64 bit release. Once this box is downloaded
# to your host computer, it is cached for future use under the specified box name.
config.vm.box = "ubuntu/trusty64"
# The Parallels Provider uses a different naming scheme.
config.vm.provider :parallels do |v, override|
override.vm.box = "parallels/ubuntu-14.04"
end
# The VMware Fusion Provider uses a different naming scheme.
config.vm.provider :vmware_fusion do |v, override|
override.vm.box = "netsensia/ubuntu-trusty64"
end
# VMWare Workstation can use the same package as Fusion
config.vm.provider :vmware_workstation do |v, override|
override.vm.box = "netsensia/ubuntu-trusty64"
end
# Hyper-V uses a different base box.
config.vm.provider :hyperv do |v, override|
override.vm.box = "ericmann/trusty64"
end
config.vm.hostname = "owt"
# Local Machine Hosts
#
# If the Vagrant plugin hostsupdater (https://github.com/cogitatio/vagrant-hostsupdater) is
# installed, the following will automatically configure your local machine's hosts file to
# be aware of the domains specified below. Watch the provisioning script as you may need to
# enter a password for Vagrant to access your hosts file.
#
# Private Network (default)
#
# A private network is created by default. This is the IP address through which your
# host machine will communicate to the guest. In this default configuration, the virtual
# machine will have an IP address of 192.168.50.4 and a virtual network adapter will be
# created on your host machine with the IP of 192.168.50.1 as a gateway.
#
# Access to the guest machine is only available to your local host. To provide access to
# other devices, a public network should be configured or port forwarding enabled.
#
# Note: If your existing network is using the 192.168.50.x subnet, this default IP address
# should be changed. If more than one VM is running through VirtualBox, including other
# Vagrant machines, different subnets should be used for each.
#
config.vm.network :private_network, id: "owt_primary", ip: "192.168.50.8"
config.vm.provider :hyperv do |v, override|
override.vm.network :private_network, id: "owt_primary", ip: nil
end
# Public Network (disabled)
#
# Using a public network rather than the default private network configuration will allow
# access to the guest machine from other devices on the network. By default, enabling this
# line will cause the guest machine to use DHCP to determine its IP address. You will also
# be prompted to choose a network interface to bridge with during `vagrant up`.
#
# Please see VVV and Vagrant documentation for additional details.
#
# config.vm.network :public_network
# Port Forwarding (disabled)
#
# This network configuration works alongside any other network configuration in Vagrantfile
# and forwards any requests to port 8080 on the local host machine to port 80 in the guest.
#
# Port forwarding is a first step to allowing access to outside networks, though additional
# configuration will likely be necessary on our host machine or router so that outside
# requests will be forwarded from 80 -> 8080 -> 80.
#
# Please see VVV and Vagrant documentation for additional details.
#
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Drive mapping
#
# The following config.vm.synced_folder settings will map directories in your Vagrant
# virtual machine to directories on your local machine. Once these are mapped, any
# changes made to the files in these directories will affect both the local and virtual
# machine versions. Think of it as two different ways to access the same file. When the
# virtual machine is destroyed with `vagrant destroy`, your files will remain in your local
# environment.
# /srv/config/
#
# If a server-conf directory exists in the same directory as your Vagrantfile,
# a mapped directory inside the VM will be created that contains these files.
# This directory is currently used to maintain various config files for php and
# nginx as well as any pre-existing database files.
config.vm.synced_folder "config/", "/srv/config"
# /srv/source/
#
# If a source directory exists in the same directory as your Vagrantfile,
# a mapped directory inside the VM will be created that contains these files.
# This directory is used to maintain source
config.vm.synced_folder "source/", "/srv/source"
config.vm.provision "fix-no-tty", type: "shell" do |s|
s.privileged = false
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
end
# Provisioning
#
# Process one or more provisioning scripts depending on the existence of custom files.
#
# provison-pre.sh acts as a pre-hook to our default provisioning script. Anything that
# should run before the shell commands laid out in provision.sh (or your provision-custom.sh
# file) should go in this script. If it does not exist, no extra provisioning will run.
if File.exists?(File.join(vagrant_dir,'provision','provision-pre.sh')) then
config.vm.provision "pre", type: "shell", path: File.join( "provision", "provision-pre.sh" )
end
# provision.sh or provision-custom.sh
#
# By default, Vagrantfile is set to use the provision.sh bash script located in the
# provision directory. If it is detected that a provision-custom.sh script has been
# created, that is run as a replacement. This is an opportunity to replace the entirety
# of the provisioning provided by default.
if File.exists?(File.join(vagrant_dir,'provision','provision-custom.sh')) then
config.vm.provision "custom", type: "shell", path: File.join( "provision", "provision-custom.sh" )
else
config.vm.provision "default", type: "shell", path: File.join( "provision", "provision.sh" )
end
# provision-post.sh acts as a post-hook to the default provisioning. Anything that should
# run after the shell commands laid out in provision.sh or provision-custom.sh should be
# put into this file. This provides a good opportunity to install additional packages
# without having to replace the entire default provisioning script.
if File.exists?(File.join(vagrant_dir,'provision','provision-post.sh')) then
config.vm.provision "post", type: "shell", path: File.join( "provision", "provision-post.sh" )
end
# Vagrant Triggers
#
# If the vagrant-triggers plugin is installed, we can run various scripts on Vagrant
# state changes like `vagrant up`, `vagrant halt`, `vagrant suspend`, and `vagrant destroy`
#
end