-
Notifications
You must be signed in to change notification settings - Fork 24
/
Vagrantfile
45 lines (36 loc) · 1.14 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
#!/usr/bin/env ruby
# vagrant development environment
# read settings file
require "yaml"
cd = File.dirname(__FILE__)
settings = YAML.load_file("#{cd}/settings.yaml")
# check for requried plugins
settings["plugins"].each do |plugin|
unless Vagrant.has_plugin?(plugin)
raise "Missing plugin! Run: vagrant plugin install #{plugin}"
end
end
Vagrant.configure(2) do |config|
# virtual box settings
config.vm.box = settings["box"]
config.vm.hostname = settings["hostname"]
config.vm.provider :virtualbox do |vb|
vb.name = "LDAP Development"
vb.memory = 1024
vb.cpus = 2
end
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
# install puppet agent
config.vm.provision :shell, inline: <<-SHELL
if ! type -p puppet >/dev/null 2>&1; then
rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
yum install -y puppet-agent
fi
SHELL
# install puppet modules
settings["modules"].each do |mod|
config.vm.provision :shell, inline: "puppet module install " + mod
end
# apply puppet configuration
config.vm.provision :shell, inline: "puppet apply /vagrant/default.pp"
end