-
Notifications
You must be signed in to change notification settings - Fork 0
/
puppetmaster-bootstrap.sh
executable file
·40 lines (30 loc) · 1.13 KB
/
puppetmaster-bootstrap.sh
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
#!/bin/bash
. /vagrant/puppetclient-bootstrap.sh
if $(dpkg --status puppetmaster | egrep -q "^Version: $VERSION"); then
echo "puppetmaster already installed."
else
echo "Installing puppetmaster..."
aptitude -q -y install puppetmaster=$VERSION puppetmaster-common=$VERSION
update-rc.d puppetmaster enable
fi
if $(dpkg -l | grep -q rubygems); then
echo "rubygems already installed."
else
echo "Installing rubygems..."
aptitude -q -y install rubygems
fi
if [ ! $(egrep '^autosign=' /etc/puppet/puppet.conf) ]; then
echo "Setting master to autosign every certificate requests..."
echo "autosign=true" >> /etc/puppet/puppet.conf
fi
if [ ! $(egrep '^certname=' /etc/puppet/puppet.conf) ]; then
echo "Setting certname..."
echo "certname=puppetmaster.vagrant.local" >> /etc/puppet/puppet.conf
fi
if [ ! -f /usr/lib/ruby/1.8/json.rb ]; then
echo "Setting up json library for puppetmaster"
gem install -i /usr/lib/ruby/1.8/ json
cp -a /usr/lib/ruby/1.8/gems/json-1.7.7/lib/json* /usr/lib/ruby/1.8/
fi
[ -x /vagrant/puppetmaster-code.sh ] && /vagrant/puppetmaster-code.sh
service puppetmaster restart