-
Notifications
You must be signed in to change notification settings - Fork 20
/
Vagrantfile
52 lines (42 loc) · 1.36 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
#!/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 = "OpenSSL Development"
vb.memory = 1024
vb.cpus = 2
end
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
# ensure vagrant user starts in sync directory
config.vm.provision :shell, inline: <<-SHELL
if ! grep -q 'cd /vagrant' /home/vagrant/.bashrc; then
echo 'cd /vagrant' >> /home/vagrant/.bashrc
fi
SHELL
# 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