-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
58 lines (45 loc) · 1.79 KB
/
Vagrantfile
File metadata and controls
58 lines (45 loc) · 1.79 KB
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
################################################################################
API_VERSION=2
################################################################################
parameters = YAML.load_file('settings.yml')
nodes = parameters["nodes"]
settings = parameters["settings"]
################################################################################
Vagrant.configure(API_VERSION) do |config|
nodes.each do |node_name, node_data|
config.vm.define node_name, autostart: false do |conf|
conf.vm.box = node_data["image"] || "ubuntu/trusty64"
conf.vm.box_check_update = false
conf.ssh.forward_agent = true
conf.vm.hostname = "#{node_name}"
conf.vm.network "private_network", ip: node_data["ip_addr"]
conf.vm.provider "virtualbox" do |vbox|
vbox.memory = node_data["memory"] || 512
vbox.cpus = node_data["cpus"] || 1
end
conf.vm.provision :ansible do |ansible|
ansible.limit = node_name
ansible.playbook = File.join(settings['source_path'], settings['playbook'])
if !(settings["tags"].nil?)
ansible.tags = settings["tags"]
end
ansible.extra_vars = "@#{File.join(settings['source_path'], settings['config_path'])}"
ansible.groups = {
"nginx" => node_name,
"php" => node_name,
"hhvm" => node_name,
"apache" => node_name,
"mysql" => node_name,
"nosql" => node_name,
"app:children" => ["php", "hhvm", "apache"],
"db:children" => ["mysql"],
"fe:children" => ["nginx"],
}
end
end
end
end
################################################################################