-
Notifications
You must be signed in to change notification settings - Fork 5
/
Vagrantfile
32 lines (30 loc) · 1.13 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
# Require YAML module
require 'yaml'
# Read YAML file with box details
inventory = YAML.load_file('tests/inventory.yml')
Vagrant.configure("2") do |config|
config.vm.define "dc" do |dc|
inventory['all']['children']['primarydomaincontroller']['hosts'].each do |server,details|
dc.vm.box = details['vagrant_box']
dc.vm.hostname = server
dc.vm.network :private_network, ip: details['ansible_host']
inventory['all']['vars']['vagrant_ports'].each do |protocol,details|
dc.vm.network :forwarded_port, guest: details['guest'], host: details['host'], id: protocol
end
dc.vm.provider :virtualbox do |v|
v.name = File.basename(File.dirname(__FILE__)) + "_" + server + "_" + Time.now.to_i.to_s
v.gui = false
v.memory = 2048
v.cpus = 2
end
end
end
inventory['all']['children']['primarydomaincontroller']['hosts'].each do |server,details|
config.vm.provision "ansible" do |ansible|
ansible.playbook = "tests/test.yml"
ansible.limit = "all"
ansible.inventory_path = "tests/inventory.yml"
ansible.verbose = "-vvvv"
end
end
end