Use this for files, scripts, aliases, etc to deploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
713 B

## "ansifix" keeps the puppet manifests updated from gitea
## a quick check confirms alterationa to local files
## else.. those are updated with latest from gitea
set -u
## -- path to the Ansible dirs
ANSBASE=/var/lib/ansible/
echo "$(date +'%F_%R:%S') ==== START ==== "
## -- check each repo in turn
cd ${ANSBASE}
echo -e "$(date +'%F_%R:%S') checking ${ANSBASE} ... \c"
STATUS="$(git status | tail -n1)"
if [[ ! ${STATUS} =~ "nothing to commit" ]]
then
echo "need to fix $ANSBASE, showing diff on next line"
git diff
git fetch origin &> /dev/null
git reset --hard origin/master &> /dev/null
else
echo " ${STATUS}"
fi
git pull &> /dev/null
echo "$(date +'%F_%R:%S') ------ END ------"