1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-14 20:22:08 +00:00

handle apt upgrades from 2.2.1 to 2.4.0

This commit is contained in:
Jerry Vonau 2017-09-27 15:38:00 -05:00
parent f8d663d713
commit 88cd7d0fb6

View file

@ -5,13 +5,15 @@ URL="NA"
# TODO add check for version - to revese patching if upgrading
if [ $(which ansible-playbook) ]; then
VER=`ansible --version|head -n 1|cut -f 2 -d " "`
if [ $VER="2.2.0.0" ]; then
GOOD_VER="$VER | grep 2.4 | wc -l"
if [ $VER = "2.2.0.0" ]; then
echo "Ansible $VER installed updating to 2.4.0"
pip install --upgrade ansible==2.4.0 --disable-pip-version-check
# sed -i 's/StrictVersion/LooseVersion/g' /usr/lib/python2.7/dist-packages/ansible/modules/core/web_infrastructure/htpasswd.py
fi
exit 0
fi
fi
# TODO add check for version - to revese patching if upgrading
#if [ $(which ansible-playbook) ]; then
# VER=`ansible --version|head -n 1|cut -f 2 -d " "`
@ -93,21 +95,20 @@ fi
### start ansible pip install TODO add venv location /opt/iiab/anisble
if [ $FAMILY = "olpc" ]; then
pip install ansible==2.2.1 --disable-pip-version-check
pip install ansible==2.4.0 --disable-pip-version-check
VER=`ansible --version|head -n 1|cut -f 2 -d " "`
echo "ansible version installed via pip $VER"
fi
# TODO add check for version to skip patching
# APPLY TEMPORARY PATCH
# https://github.com/ansible/ansible/pull/20202
# https://github.com/iiab/iiab/issues/249
#if [ $FAMILY != "redhat" ]; then
# echo "Patching..."
# sed -i 's/StrictVersion/LooseVersion/g' /usr/lib/python2.7/dist-packages/ansible/modules/core/web_infrastructure/htpasswd.py
#fi
# handle 2.2.1 2.2.0.0 <-> 2.4.0
if [ $FAMILY = "debian" ]; then
if [ $GOOD_VER -lt 1 ]; then
sed -i 's/LooseVersion/StrictVersion/g' /usr/lib/python2.7/dist-packages/ansible/modules/core/web_infrastructure/htpasswd.py
apt-get -y upgrade ansible
fi
fi
VER=`ansible --version|head -n 1|cut -f 2 -d " "`
echo "ansible version installed via package manager $VER"
echo "Current ansible version installed is $VER"
# sample only
#if [ $FAMILY = "debian" ]; then