tripleo-heat-templates/extraconfig/tasks/run_puppet.sh
Sofer Athlan-Guyot 237cd2004a Apply puppet in non-controller script in step.
We want to apply a puppet manifest for the non-controller role, but we
need to apply it in stages.  By loading the proper hieradata we get the
needed step configuration.

Change-Id: I07bfeee7b7d9a9b8c2c20e5d5c9ed735d0bfc842
Closes-Bug: #1664304
2017-02-15 16:41:39 +01:00

28 lines
616 B
Bash
Executable File

#!/bin/bash
function run_puppet {
set -eux
local manifest="$1"
local role="$2"
local step="$3"
local rc=0
export FACTER_deploy_config_name="${role}Deployment_Step${step}"
if [ -e "/etc/puppet/hieradata/heat_config_${FACTER_deploy_config_name}.json" ]; then
set +e
puppet apply --detailed-exitcodes "${manifest}"
rc=$?
echo "puppet apply exited with exit code $rc"
else
echo "Step${step} doesn't exist for ${role}"
fi
set -e
if [ $rc -eq 2 -o $rc -eq 0 ]; then
set +xu
return 0
fi
set +xu
return $rc
}