forked from geerlingguy/drupal-vm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
69 lines (59 loc) · 2.34 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
# Use config.yml for basic VM configuration.
require 'yaml'
if !File.exist?('./config.yml')
raise 'Configuration file not found! Please copy example.config.yml to config.yml and try again.'
end
vconfig = YAML::load_file("./config.yml")
# Use rbconfig to determine if we're on a windows host or not.
require 'rbconfig'
is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.hostname = vconfig['vagrant_hostname']
config.vm.network :private_network, ip: vconfig['vagrant_ip']
config.ssh.insert_key = false
config.vm.box = "geerlingguy/ubuntu1404"
for synced_folder in vconfig['vagrant_synced_folders'];
config.vm.synced_folder synced_folder['local_path'], synced_folder['destination'],
type: synced_folder['type'],
rsync__auto: "true",
rsync__exclude: synced_folder['excluded_paths'],
rsync__args: ["--verbose", "--archive", "--delete", "-z", "--chmod=ugo=rwX"],
id: synced_folder['id'],
create: synced_folder.include?('create') ? synced_folder['create'] : false
end
if is_windows
# Provisioning configuration for shell script (for Windows).
config.vm.provision "shell" do |sh|
sh.path = "provisioning/JJG-Ansible-Windows/windows.sh"
sh.args = "provisioning/playbook.yml"
end
else
# Provisioning configuration for Ansible (for Mac/Linux hosts).
config.vm.provision "ansible" do |ansible|
ansible.playbook = "provisioning/playbook.yml"
ansible.sudo = true
end
end
# VMware Fusion.
config.vm.provider :vmware_fusion do |v, override|
# HGFS kernel module currently doesn't load correctly for native shares.
override.vm.synced_folder ".", "/vagrant", type: 'nfs'
v.gui = false
v.vmx["memsize"] = vconfig['vagrant_memory']
v.vmx["numvcpus"] = vconfig['vagrant_cpus']
end
# VirtualBox.
config.vm.provider :virtualbox do |v|
v.name = vconfig['vagrant_hostname']
v.memory = vconfig['vagrant_memory']
v.cpus = vconfig['vagrant_cpus']
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--ioapic", "on"]
end
# Set the name of the VM. See: http://stackoverflow.com/a/17864388/100134
config.vm.define :drupaldev do |drupaldev_config|
end
end