blob: 402558cea1279187b12c5006e12a4089548501ef (
plain)
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
|
#!/bin/bash
#
# Puppet templater module.
#
# Parameters
SHARE="$1"
PROJECT="$(basename `pwd`)"
BOOTSTRAP="https://git.fluxo.info/puppet-bootstrap"
# Include basic functions
source $SHARE/templater/functions || exit 1
# Puppet implementation
function templater_puppet {
if [ ! -d "puppet" ]; then
templater_echo "Setting up puppet..."
if [ ! -d '.git' ]; then
templater_echo "Error: puppet needs a working git setup, skipping"
return
fi
if [ "`git status -s | wc -l`" != 0 ]; then
templater_echo "Please commit changes before running setting up puppet"
return
fi
# Use the best approach
#git clone $BOOSTRAP puppet
#git submodule add $BOOSTRAP puppet
git remote add puppet $BOOTSTRAP
git subtree add --prefix puppet $BOOTSTRAP master --squash
# Setup node config
if [ -e "puppet/config/node/box.example.org.yaml" ]; then
cp puppet/config/node/box.example.org.yaml puppet/config/node/$PROJECT.example.org.yaml
fi
else
templater_echo "Puppet already set"
fi
}
# Dispatch
templater_puppet
|