-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
56 lines (41 loc) · 1.58 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 :
Vagrant.configure(2) do |config|
config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
# Install puppet on every host
config.vm.provision "shell", inline: <<-SHELL
# Test if puppet is installed
if ! $(dpkg -s puppet > /dev/null 2>&1); then
# Configure puppetlabs apt repository
wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
sudo dpkg -i puppetlabs-release-trusty.deb
# Install puppet
sudo apt-get update
sudo apt-get install -y puppet=3.7.4-1puppetlabs1
fi
SHELL
config.vm.define "nginx" do |nginx|
nginx.vm.network "private_network", ip: "10.0.0.2"
nginx.vm.provision "puppet" do |puppet|
puppet.module_path = "puppet/modules"
puppet.manifests_path = "puppet/vagrant-manifests"
puppet.hiera_config_path = "puppet/hiera.yaml"
puppet.manifest_file = "nginx.pp"
end
nginx.vm.provision "shell",
inline: "/bin/nc -w 1 localhost 80 > /dev/null || echo Error: The application was not started successfully!"
end
(3..4).each do |i|
config.vm.define "app-#{i}" do |app|
app.vm.network "private_network", ip: "10.0.0.#{i}"
app.vm.provision "puppet" do |puppet|
puppet.module_path = "puppet/modules"
puppet.manifests_path = "puppet/vagrant-manifests"
puppet.hiera_config_path = "puppet/hiera.yaml"
puppet.manifest_file = "app.pp"
end
app.vm.provision "shell",
inline: "/bin/nc -w 1 localhost 8000 > /dev/null || echo Error: The application was not started successfully!"
end
end
end