Skip to content

Instantly share code, notes, and snippets.

@TJM
Created April 26, 2019 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TJM/933b75059445a5f8283ade5b8084f76e to your computer and use it in GitHub Desktop.
Save TJM/933b75059445a5f8283ade5b8084f76e to your computer and use it in GitHub Desktop.
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