#!/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 if [ -e "puppet/Puppetfile" ]; then cp $SHARE/puppet/files/Puppetfile.dist puppet fi else templater_echo "Puppet already set" fi } # Dispatch templater_puppet