-
Notifications
You must be signed in to change notification settings - Fork 17
/
run.sh
executable file
·44 lines (37 loc) · 1.14 KB
/
run.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
40
41
42
43
44
#!/bin/sh
if [ "$LOGNAME" != 'root' ]; then
echo "Must be root";
exit 1;
fi
find /etc/puppet -type d -exec chmod a+rx {} \;
find /etc/puppet -type f -exec chmod a+r {} \;
cd /etc/puppet
# Aways specify the cername so we get the right config
# the arg should really exist in the autosign.conf if possible
CERTNAME=$1
if [ ! $CERTNAME ]
then
CERTNAME=$(hostname -s)
echo "Assuming node $CERTNAME"
echo "Supply a node arg to override"
fi
# Just create a basic conf to set parser=future
if [ ! -e "puppet.conf" ]
then
echo "[main]" >> puppet.conf
echo "parser=future" >> puppet.conf
echo "basemodulepath=/etc/puppet/modules/contrib:/etc/puppet/modules/metacpan" >> puppet.conf
fi
if grep -Fq "parser=future" puppet.conf
then
echo "parser=future enabled, carry on..."
else
echo "You need to add 'parser=future' to the puppet.conf"
exit
fi
# Stop complaints on vagrant
mkdir -p private
# Ugly hack to make a local class apply the facts
export FACTERLIB=/etc/puppet/modules/facts/lib/facter
# Run Puppet
puppet apply --modulepath /etc/puppet/contrib-modules:/etc/puppet/modules --show_diff --certname=$CERTNAME manifests/site.pp $@