Last active
January 9, 2018 03:28
-
-
Save ravibhure/3033f2de466ade8c2fda293bf890ef9a to your computer and use it in GitHub Desktop.
Install ansible another way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ANSIBLE_VERSION if not provided, script will install default ansible version which is 2.3.1 | |
ANSIBLE_VERSION=$1 | |
_pip_deps(){ | |
pip --quiet install -U setuptools > /dev/null 2>&1 | |
pip --quiet install -U pip > /dev/null 2>&1 | |
} | |
# just to sleep | |
sleep 20 ; | |
if [[ -f /etc/redhat-release ]];then | |
yum -y update > /dev/null 2>&1 && \ | |
yum -q -y groupinstall \"Development Tools\" > /dev/null 2>&1 && \ | |
yum -q -y install gcc libffi-devel openssl-devel curl python-devel python-pip > /dev/null 2>&1; | |
else | |
apt-get -qq update > /dev/null 2>&1 && \ | |
apt-get -qq -y install build-essential libssl-dev libffi-dev curl software-properties-common python-dev python-setuptools python-pip > /dev/null 2>&1; | |
fi | |
#curl -s -L https://bootstrap.pypa.io/get-pip.py | sudo python | |
if [ ! -z $ANSIBLE_VERSION ] ; then | |
_pip_deps | |
pip --quiet install -U ansible==$ANSIBLE_VERSION | |
else | |
_pip_deps | |
pip --quiet install -U 'ansible>=2.3.1,<2.4.0' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment