-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile
121 lines (97 loc) · 4.35 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
#-----------------------------------------------------------------------------
# Application Configuration
#-----------------------------------------------------------------------------
app_config = {
"name" => "magento-vagrant",
"box" => "precise64",
"box_url" => "https://files.vagrantup.com/precise64.box",
"guest_ip" => "33.33.33.10",
"memory" => "2048",
"hostname" => "magento.dev",
"sync_folder" => "/www/magento",
"docroot" => "/www/magento",
"chef_version" => "11.8.0"
}
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_plugin "vagrant-berkshelf"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
#-----------------------------------------------------------------------------
# Omnibus Plugin
#-----------------------------------------------------------------------------
if Vagrant.has_plugin?("vagrant-omnibus") then
config.omnibus.chef_version = app_config["chef_version"]
end
#-----------------------------------------------------------------------------
# Berkshelf Plugin
#-----------------------------------------------------------------------------
if Vagrant.has_plugin?("vagrant-berkshelf") then
config.berkshelf.enabled = true
end
#-----------------------------------------------------------------------------
# Hostmanager Plugin
#-----------------------------------------------------------------------------
if Vagrant.has_plugin?("vagrant-hostmanager") then
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = false
end
#-----------------------------------------------------------------------------
# Vagrant Box
#-----------------------------------------------------------------------------
config.vm.box = app_config["box"]
config.vm.box_url = app_config["box_url"]
config.vm.hostname = app_config["hostname"]
#-----------------------------------------------------------------------------
# Networking
#-----------------------------------------------------------------------------
config.vm.network :private_network, ip: app_config["guest_ip"]
#-----------------------------------------------------------------------------
# SSH
#-----------------------------------------------------------------------------
config.ssh.forward_agent = true
#-----------------------------------------------------------------------------
# Synced Folders
#-----------------------------------------------------------------------------
# NFS sync folder
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder "./magento", app_config["sync_folder"], type: "nfs"
#-----------------------------------------------------------------------------
# VirtualBox Provider
#-----------------------------------------------------------------------------
config.vm.provider :virtualbox do |vb|
vb.gui = false
vb.customize ["modifyvm", :id, "--memory", app_config["memory"]]
vb.customize ["modifyvm", :id, "--name", app_config["name"]]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
#-----------------------------------------------------------------------------
# Chef-Solo Provision
#-----------------------------------------------------------------------------
config.vm.provision "chef_solo" do |chef|
VAGRANT_JSON = JSON.parse(Pathname(__FILE__).dirname.join('chef/nodes', 'vagrant.json').read)
chef.roles_path = "./chef/roles"
chef.data_bags_path = "./chef/data_bags"
chef.environments_path = "./chef/environments"
chef.environment = "dev"
chef.log_level = "debug"
chef.run_list = VAGRANT_JSON.delete('run_list')
chef.json = VAGRANT_JSON.merge!({
"mysql" => {
"server_root_password" => "freemail",
"server_repl_password" => "freemail",
"server_debian_password" => "freemail"
},
"magento" => {
"dir" => app_config["sync_folder"]
}
})
chef.add_role("vagrant")
chef.add_role("webserver")
chef.add_recipe("magento-ce")
end
end