This repository has been archived by the owner on Sep 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
go
46 lines (34 loc) · 1.93 KB
/
go
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
SETUP_DIR=/Users/rick/git/
THIS_DIR=${SETUP_DIR}/puppetshow
PATH=$PATH:$SETUP_DIR/facter/bin:$SETUP_DIR/puppet/bin
RUBYLIB=$SETUP_DIR/facter/lib:$SETUP_DIR/puppet/lib
export PATH RUBYLIB
cd ${SETUP_DIR}/puppet # wherever the puppet checkout is
# install our custom report
cp ${THIS_DIR}/rails/puppet/report/puppet_show.rb ${SETUP_DIR}/puppet/lib/puppet/reports/
# kill off any old processes
ps auxwww | grep pup[p]etmaster | awk '{print $2}' | xargs sudo kill
ps auxwww | grep pup[p]etd | awk '{print $2}' | xargs sudo kill
sleep 1
ps auxwww | grep pup[p]etmaster | awk '{print $2}' | xargs sudo kill -9
ps auxwww | grep pup[p]etd | awk '{print $2}' | xargs sudo kill -9
# clean up from any previous runs
sudo rm -rf /tmp/puppet
sudo rm -f /tmp/report_testing_output.txt
# make confdir and vardir
mkdir -p /tmp/puppet/var
# make sure we have a trivial manifest installed
mkdir -p /tmp/puppet/manifests
echo "node default { }" > /tmp/puppet/manifests/site.pp
# startup a puppetmasterd instance
sudo puppetmasterd --vardir /tmp/puppet/var --confdir /tmp/puppet --user rick --group staff --debug --trace --reports=store,puppet_show
# initial start of puppetd for cert shit
sudo puppetd --no-http_enable_post_connection_check --vardir /tmp/puppet/var --confdir /tmp/puppet/ --user rick --group staff --debug --trace -t --report --server localhost --waitforcert 60
# get the cert bullshit right
sudo puppetca --clean rick-bradleys-computer.local --user rick --group staff --confdir /tmp/puppet/ --vardir /tmp/puppet/var --sign all
# and attempt to run puppet, generate a report
sudo puppetd --no-http_enable_post_connection_check --vardir /tmp/puppet/var --confdir /tmp/puppet/ --user rick --group staff --debug --trace -t --report --server localhost --noop --onetime
# what's in the reports dir?
ls -altrR /tmp/puppet/var/reports/
ls -tr /tmp/puppet/var/reports/*/ | tail -1 | sed 's:^:sudo cat /tmp/puppet/var/reports/*/:' | sh -s
cat /tmp/report_testing_output.txt