-
Notifications
You must be signed in to change notification settings - Fork 14
/
Vagrantfile
56 lines (40 loc) · 1.39 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
# -*- 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'
# Read YAML file with box details
servers = YAML.load_file('servers.yaml')
# Create boxes
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Iterate through entries in YAML file
servers.each do |servers|
config.vm.define servers["name"] do |srv|
srv.vm.hostname = servers["name"]
srv.vm.box = servers["box"]
srv.vm.network "private_network", ip: servers["ip"]
servers["forward_ports"].each do |port|
srv.vm.network :forwarded_port, guest: port["guest"], host: port["host"]
end
srv.vm.provider :virtualbox do |v|
v.cpus = servers["cpu"]
v.memory = servers["ram"]
end
srv.vm.synced_folder "./", "/home/vagrant/#{servers['name']}"
servers["shell_commands"].each do |sh|
srv.vm.provision "shell", inline: sh["shell"]
end
srv.vm.provision :puppet do |puppet|
puppet.temp_dir = "/tmp"
puppet.options = ['--pluginsync', '--modulepath=/tmp/modules', '--verbose']
puppet.hiera_config_path = "hiera.yaml"
puppet.environment_path = './'
puppet.environment = 'production'
puppet.manifests_path = 'manifests'
puppet.manifest_file = 'default.pp'
end
end
end
end