-
Notifications
You must be signed in to change notification settings - Fork 18
/
Vagrantfile
96 lines (75 loc) · 2.92 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
#! /usr/bin/env ruby
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
require 'rbconfig'
params = YAML::load_file(File.join(__dir__, 'default.config.yaml'))
# Load new configuration files.
begin
params = params.merge YAML::load_file(File.join(__dir__, 'config.yaml'))
rescue
# The customization file didn't exist - no worries.
end
is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
# Include our deploy command.
require File.join(__dir__, '/ssh-add.rb') unless is_windows
Vagrant.configure('2') do |config|
config.vm.hostname = params['hostname']
config.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', params['memory']]
vb.cpus = params['cpus']
# Fix slow DNS - http://serverfault.com/questions/495914/vagrant-slow-internet-connection-in-guest
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.customize ["modifyvm", :id, "--ioapic", "on"]
end
config.vm.network :private_network, ip: params['private_ipv4']
config.vm.network :private_network, ip: params['private_ipv6']
config.vm.box = params['box']
config.vm.box_url = params['box_url']
config.ssh.forward_agent = true
config.vm.provision :shell, :inline => "apt-get update --fix-missing"
if Vagrant.has_plugin?("vagrant-librarian-puppet")
config.librarian_puppet.placeholder_filename = 'README.md'
elsif not File.exist?(File.join(__dir__, 'modules', 'drupal_php', 'manifests', 'init.pp'))
raise Vagrant::Errors::VagrantError.new, "You are not using vagrant-librarian-puppet and have not installed the dependencies."
end
# If vagrant-cachier is installed, use it!
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
if not is_windows
# See https://github.com/fgrehm/vagrant-cachier for details.
config.cache.synced_folder_opts = {
type: :nfs,
mount_options: ['rw', 'vers=3', 'tcp', 'nolock']
}
end
end
# NFS sharing does not work on windows, so if this is windows don't try to start it.
vagrant_share_www = "false"
if not is_windows and params['sync_folder']
config.vm.synced_folder 'www', '/var/www', :nfs => true
vagrant_share_www = "true"
elsif params['sync_file_enabled_on_windows']
# This uses VirtualBox shared folders and symlinks will not work properly.
config.vm.synced_folder 'www', '/var/www'
vagrant_share_www = "true"
end
config.vm.provision :puppet do |puppet|
puppet.facter = {
"vagrant" => "1",
"vagrant_share_www" => vagrant_share_www
}
puppet.hiera_config_path = 'hiera/hiera.yaml'
puppet.working_directory = '/vagrant'
puppet.manifests_path = 'manifests'
puppet.module_path = [
"modules",
"custom-modules"
]
puppet.manifests_path = "manifests"
puppet.manifest_file = "."
puppet.environment_path = "environments"
puppet.environment = "dev"
end
end