Skip to content
Snippets Groups Projects

Draft: Deploy roles

2 files
+ 42
0
Compare changes
  • Side-by-side
  • Inline

Files

+ 30
0
#!/bin/bash
#
# Deploy a role using Puppet Apply.
set -x
CLASS=${1}
if [ -z "${CLASS}" ]; then
echo "Usage: ${0} class"
exit 1
fi
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
REPO_DIR="$( dirname ${SCRIPT_DIR} )"
apt update
apt install -qy puppet
git -C ${REPO_DIR} submodule update --init
# deploy a role
puppet apply \
--detailed-exitcodes \
--modulepath ${REPO_DIR}/modules \
--hiera-config ${REPO_DIR}/hiera.yaml \
--codedir ${REPO_DIR} \
-e "include ${CLASS}"
test "${?}" = 2 || exit 1 # Puppet exit code 2: The run succeeded, and some resources were changed.
Loading