fixed some issue

This commit is contained in:
Beth Parker 2024-10-05 18:11:45 -05:00
parent 8dc583b44e
commit 8e171bb79d

View file

@ -39,7 +39,7 @@ if $regrab;then
# update build_ansible file and update branch/timestamp info in current # update build_ansible file and update branch/timestamp info in current
cp /tmp/build_ansible.sh /ansible/build_ansible.sh cp /tmp/build_ansible.sh /ansible/build_ansible.sh
echo ${branch}:$c_time > /ansible/current echo ${branch}:`date +%s` > /ansible/current
# verify the parent script is not build_ansible.sh (to prevent the possibility of recurring until the system crashes in the case of an issue) # verify the parent script is not build_ansible.sh (to prevent the possibility of recurring until the system crashes in the case of an issue)
me=$(basename "$0") me=$(basename "$0")
@ -55,7 +55,7 @@ curl -k "https://git.actcur.com/actcur-ansible/playbook-builder/raw/branch/$bran
# verify file was downloaded successfully # verify file was downloaded successfully
count=`grep -P "end of file" /tmp/$fqdn | wc -l` count=`grep -P "end of file" /tmp/$fqdn | wc -l`
if [ "$count" != "2" ];then if [ "$count" != "1" ];then
echo "failed to grab current playbook build file for $fqdn, exiting" echo "failed to grab current playbook build file for $fqdn, exiting"
exit exit
fi fi
@ -73,11 +73,10 @@ echo "- hosts: $fqdn
roles:" > /ansible/new/$fqdn.yml roles:" > /ansible/new/$fqdn.yml
lines=`cat /tmp/$fqdn` while read line
for line in $lines
do do
elements=() elements=()
for element in $(echo $line | tr ";" "\n"); do elements+=("$e") for element in $(echo $line | tr ";" "\n"); do elements+=("$e");done
case ${elements[0]} in case ${elements[0]} in
"role") "role")
# format role:role name:branch/tag to use # format role:role name:branch/tag to use
@ -111,7 +110,7 @@ do
echo "entry: $line" echo "entry: $line"
;; ;;
esac esac
done done </tmp/$fqdn
rm -r /ansible/prev/* rm -r /ansible/prev/*
mv /ansible/$fqdn.yml /ansible/prev/ mv /ansible/$fqdn.yml /ansible/prev/
mv /ansible/roles/ /ansible/prev mv /ansible/roles/ /ansible/prev