-
Notifications
You must be signed in to change notification settings - Fork 3
/
Vagrantfile
67 lines (55 loc) · 2.05 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
INSTANCES=2
PROVISION_PUPPET = <<PUPPET
/bin/rpm -ivh http://yum.puppetlabs.com/puppet7/puppet7-release-el-7.noarch.rpm
/usr/bin/yum -y install puppet-agent
echo '*' > /etc/puppetlabs/puppet/autosign.conf
/opt/puppetlabs/bin/puppet resource host puppet.choria ensure=present ip=192.168.190.5 host_aliases=puppet
mkdir -p /etc/puppetlabs/facter/facts.d
echo "role=${1}" > /etc/puppetlabs/facter/facts.d/role.txt
PUPPET
Vagrant.configure("2") do |config|
config.vm.define :puppet do |vmconfig|
vmconfig.vm.box = "centos/7"
vmconfig.vm.hostname = "puppet.choria"
vmconfig.vm.network :private_network, ip: "192.168.190.5"
vmconfig.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", 3072]
end
vmconfig.vbguest.installer_options = { allow_kernel_upgrade: true }
vmconfig.vm.provision :shell do |s|
s.inline = PROVISION_PUPPET
s.args = "puppetserver"
end
vmconfig.vm.provision :shell do |s|
s.inline = "bash /vagrant/analytics.sh >/dev/null 2>&1 || /usr/bin/true"
end
vmconfig.vm.provision "puppet" do |puppet|
puppet.environment_path = "environments"
end
vmconfig.vm.provision "puppet_server" do |puppet|
puppet.puppet_server = "puppet.choria"
puppet.options = "--waitforcert 10 --test"
end
end
INSTANCES.times do |i|
config.vm.define "instance#{i}" do |vmconfig|
vmconfig.vm.box = "centos/7"
vmconfig.vm.hostname = "choria%s.choria" % i
vmconfig.vm.network :private_network, ip: "192.168.190.%d" % (9+i)
vmconfig.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", 1024]
end
vmconfig.vbguest.installer_options = { allow_kernel_upgrade: true }
vmconfig.vm.provision :shell do |s|
s.inline = PROVISION_PUPPET
s.args = "managed"
end
vmconfig.vm.provision "puppet_server" do |puppet|
puppet.puppet_server = "puppet.choria"
puppet.options = "--waitforcert 10 --test"
end
end
end
end