diff --git a/iiab-upgrade b/iiab-upgrade index 033cd5a7..2fcaaed0 100755 --- a/iiab-upgrade +++ b/iiab-upgrade @@ -4,6 +4,8 @@ set -e # Exit on error (avoids snowballing) export DEBIAN_FRONTEND=noninteractive # Bypass (most!) interactive questions SCRIPT=iiab-upgrade RELEASE=1 +CURR_VER="" # Ansible version you currently have installed +GOOD_VER="2.9.13" # preferred Ansible version BASEDIR=/opt/iiab CONFDIR=/etc/iiab IIABENV=$CONFDIR/iiab.env @@ -254,13 +256,18 @@ echo -e " ███████████████████████ echo -e "\n" # catch updates when apt runs # add logic to force updates later +# 2.9.13 -> 2.10.X might need the removal of /etc/ansible/ansible.cfg if [ $(command -v ansible-playbook) ]; then # "command -v" is POSIX compliant; also catches built-in commands like "cd" CURR_VER=`ansible --version | head -1 | awk '{print $2}'` # To match iiab-install. Was: CURR_VER=`ansible --version | head -n 1 | cut -f 2 -d " "` - echo -e "CURRENTLY INSTALLED ANSIBLE: $CURR_VER skipping install!" -else - echo -e "Install Ansible..." - $BASEDIR/iiab/scripts/ansible + echo -e "CURRENTLY INSTALLED ANSIBLE: $CURR_VER" + if version_gt $CURR_VER $GOOD_VER; then + echo -e "$CURR_VER is >= $GOOD_VER, skipping install!" + else + echo -e "(Re)Install Ansible..." + $BASEDIR/iiab/scripts/ansible + fi fi + echo -e "\n\n'apt update' is checking for OS updates...\n" #echo -e "2019-07-11 TEMP WORKAROUND FOR RASPBIAN BUSTER'S testing->stable apt GLITCH...\nDetails @ https://github.com/iiab/iiab/issues/1856\n" #apt -y update || true # Overrides 'set -e'