-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
73 lines (64 loc) · 2.42 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
unless Vagrant.has_plugin?("vagrant-hostmanager")
raise 'vagrant-hostmanager plugin is not installed!'
end
if Vagrant.has_plugin?("vagrant-hostmanager")
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
end
if Vagrant.has_plugin?("vagrant-triggers")
config.trigger.before [:destroy] do
target = @machine.name.to_s
targethost = `vagrant ssh #{target} -c 'facter fqdn'`.strip()
if target != 'puppetmaster'
system("vagrant ssh puppetmaster -c 'sudo puppet cert -c #{targethost}'")
end
end
end
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
config.vm.provider :virtualbox do |virtualbox, override|
override.vm.box = "vStone/centos-6.x-puppet.3.x"
end
config.vm.provider :lxc do |lxc, override|
override.vm.box = "visibilityspots/centos-7.x-puppet-3.x"
lxc.backingstore = 'dir'
end
config.vm.define :puppetmaster do |puppetmaster|
puppetmaster.vm.host_name = "puppet"
puppetmaster.vm.synced_folder "hieradata", "/etc/hiera", type: "rsync",
rsync__chown: false
puppetmaster.vm.synced_folder "puppet/environments/production", "/etc/puppet/environments/production", type: "rsync",
rsync__chown: false
puppetmaster.vm.provider :lxc do |lxc|
lxc.container_name = 'dev-puppetmaster'
end
puppetmaster.vm.provider :virtualbox do |virtualbox, override|
override.vm.network "private_network", ip: "10.0.5.2"
virtualbox.customize ["modifyvm", :id, "--memory", 3072]
end
puppetmaster.vm.provision "shell", inline: "hostname puppet"
puppetmaster.vm.provision "shell", path: "scripts/puppetmaster.sh"
end
config.vm.define :client do |client|
client.vm.host_name = "client"
client.vm.provider :lxc do |lxc|
lxc.container_name = 'dev-client'
end
client.vm.provider :virtualbox do |virtualbox, override|
override.vm.network "private_network", ip: "10.0.5.3"
end
client.vm.provision "shell", inline: "hostname client"
client.vm.provision "puppet_server" do |puppet|
default_env = 'production'
ext_env = ENV['VAGRANT_PUPPET_ENV']
env = ext_env ? ext_env : default_env
puppet.puppet_server = "puppet"
puppet.options = ["--environment", "#{env}", "--test"]
end
end
end