-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
70 lines (53 loc) · 2.05 KB
/
Vagrantfile
File metadata and controls
70 lines (53 loc) · 2.05 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
59
60
61
62
63
64
65
66
67
68
69
70
# -*- mode: ruby -*-
# # vi: set ft=ruby :
# Specify minimum Vagrant version and Vagrant API version
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
# Require YAML module
require 'yaml'
environment = ENV['ENVIRONMENT']
load "os.rb" if File.exist?("os.rb")
if environment.nil? || environment == ''
environment = 'dev'
end
# Read YAML file with box details
settings = YAML.load_file("provision/servers/#{environment}.yaml")
# Create boxes
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
settings['servers'].each do |servers|
config.vm.define servers["name"] do |srv|
srv.vm.box = servers["box"]
srv.vm.box_url = servers["url"]
srv.ssh.insert_key = false
srv.ssh.forward_agent = true
srv.vm.network :private_network, ip: servers["ip"]
srv.vm.hostname = servers["hostname"]
srv.vm.synced_folder "./","/home/vagrant/foottrial", {:mount_options => ['dmode=777','fmode=777']}
srv.vm.provider :virtualbox do |vb|
vb.name = servers["name"]
vb.memory = servers["ram"]
vb.cpus = 1
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--ioapic", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
srv.vm.provision "ansible" do |ansible|
ansible.playbook = "provision/ansible/dev/provision.yaml"
ansible.inventory_path = settings["path_inventory"]
ansible.extra_vars = settings["vagrant"]["extra_vars"]
# ansible.limit = settings["vagrant"]["limit"]
ansible.verbose = settings["vagrant"]["verbose"]
ansible.sudo = settings["vagrant"]["sudo"]
end
srv.vm.provision "ansible" do |ansible|
ansible.playbook = "provision/ansible/dev/deploy.yaml"
ansible.inventory_path = settings["path_inventory"]
ansible.extra_vars = settings["vagrant"]["extra_vars"]
# ansible.limit = settings["vagrant"]["limit"]
ansible.verbose = settings["vagrant"]["verbose"]
ansible.sudo = settings["vagrant"]["sudo"]
end
end
end
end
load "Vagrantfile.local" if File.exist?("Vagrantfile.local")