Skip to content

Instantly share code, notes, and snippets.

@TJM
Created Apr 26, 2019
Embed
What would you like to do?
Run puppet during provisioning - puppet exit code > 1 on changes caused provisioning system to think it had failed
#!/bin/bash
for (( i=0; i<5; i++ )); do
echo "Running Puppet Agent..."
/opt/puppetlabs/puppet/bin/puppet agent -t
rc=$?
if [ $rc = 0 ]; then
echo " *** SUCCESS!"
exit 0
elif [ $rc = 1 ]; then
>&2 echo " *** ERROR!"
exit 1
else
echo " *** Changes detected, will run again..."
fi
done
>&2 echo "Puppet ran 5 times, but still seeing changes. You should look into this, but I am not exiting in error"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment