mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
weren't working: -f ansible*.list & grep -q
This commit is contained in:
parent
7d535b17b2
commit
6df4e6957b
1 changed files with 32 additions and 30 deletions
|
@ -1,27 +1,29 @@
|
|||
#!/bin/bash -e
|
||||
# required to start loading IIAB with ansible
|
||||
GOOD_VER="2.4.2"
|
||||
FOUND=""
|
||||
FAMILY=""
|
||||
VER=""
|
||||
FOUND="false"
|
||||
# FAMILY="undefined" # NOT USED AS OF 2017-12-11
|
||||
VER="undefined"
|
||||
# below are unused for future use
|
||||
URL="NA"
|
||||
# URL="NA"
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
if ! [ $(which ansible-playbook) ]; then
|
||||
|
||||
if ! [ `which ansible-playbook` ]; then
|
||||
echo "Installing --- Please Wait"
|
||||
if [ -f /etc/centos-release ]; then
|
||||
yum -y install ca-certificates nss epel-release
|
||||
yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python
|
||||
yum -y install python-pip python-setuptools python-wheel patch
|
||||
yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.4.2.0-1.el7.ans.noarch.rpm
|
||||
FOUND="yes"
|
||||
FAMILY="redhat"
|
||||
FOUND="true"
|
||||
# FAMILY="redhat" # NOT USED AS OF 2017-12-11
|
||||
# elif [ -f /etc/fedora-release ]; then
|
||||
# VER=`grep VERSION_ID /etc/*elease | cut -d= -f2`
|
||||
# URL=https://github.com/jvonau/iiab/blob/ansible/vars/fedora-$VER.yml
|
||||
# dnf -y install ansible git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python
|
||||
# dnf -y install python-pip python-setuptools python-wheel patch
|
||||
# FOUND="yes"
|
||||
# FOUND="true"
|
||||
# FAMILY="redhat"
|
||||
elif [ -f /etc/olpc-release ]; then
|
||||
yum -y install ca-certificates nss
|
||||
|
@ -29,29 +31,29 @@ if ! [ $(which ansible-playbook) ]; then
|
|||
yum -y install python-pip python-setuptools python-wheel patch
|
||||
pip install --upgrade pip setuptools wheel #EOL just do it
|
||||
pip install ansible==$GOOD_VER --disable-pip-version-check
|
||||
FOUND="yes"
|
||||
FAMILY="olpc"
|
||||
elif [ -f /etc/debian_version ] || [ `grep -qi raspbian /etc/*elease` ]; then
|
||||
if [ ! `grep -qi ansible /etc/apt/sources.list` ] && [ ! -f /etc/apt/sources.list.d/ansible ]; then
|
||||
apt-get -y install dirmngr python-pip python-setuptools python-wheel patch
|
||||
FOUND="true"
|
||||
# FAMILY="olpc" # NOT USED AS OF 2017-12-11
|
||||
elif [ -f /etc/debian_version ] || [[ `grep -i raspbian /etc/*elease` ]]; then
|
||||
if [[ ! `grep -i ansible /etc/apt/sources.list` ]] && [ ! -f /etc/apt/sources.list.d/ansible ]; then
|
||||
apt -y install dirmngr python-pip python-setuptools python-wheel patch
|
||||
echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \
|
||||
>> /etc/apt/sources.list.d/ansible.list
|
||||
>> /etc/apt/sources.list.d/ansible.list
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
|
||||
fi
|
||||
FOUND="yes"
|
||||
FAMILY="debian"
|
||||
elif [ `grep -qi ubuntu /etc/lsb-release` ] || [ `grep -qi ubuntu /etc/os-release` ]; then
|
||||
apt-get -y install python-pip python-setuptools python-wheel patch
|
||||
FOUND="true"
|
||||
# FAMILY="debian" # NOT USED AS OF 2017-12-11
|
||||
elif [[ `grep -i ubuntu /etc/lsb-release` ]] || [[ `grep -qi ubuntu /etc/os-release` ]]; then
|
||||
apt -y install python-pip python-setuptools python-wheel patch
|
||||
apt-add-repository -y ppa:ansible/ansible
|
||||
FOUND="yes"
|
||||
FAMILY="debian"
|
||||
FOUND="true"
|
||||
# FAMILY="debian" # NOT USED AS OF 2017-12-11
|
||||
fi
|
||||
if [ ! $FOUND = "yes" ]; then
|
||||
echo 'WARN: Could not detect distro or distro unsupported'
|
||||
if [ ! $FOUND = "true" ]; then
|
||||
echo "WARN: Could not detect distro or distro unsupported"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
VER=`ansible --version|head -n 1|cut -f 2 -d " "`
|
||||
VER=`ansible --version | head -n 1 | cut -f 2 -d " "`
|
||||
echo "Current ansible version installed is $VER"
|
||||
if [ -f /etc/centos-release ] || [ -f /etc/fedora-release ]; then
|
||||
echo "Please use your system's package manager to update ansible"
|
||||
|
@ -61,19 +63,19 @@ else
|
|||
echo "Please use pip package manager to update ansible"
|
||||
exit 0
|
||||
fi
|
||||
if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then
|
||||
echo "repos found"
|
||||
#if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then
|
||||
if [[ `grep -i ansible /etc/apt/sources.list` ]] || ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1 ; then
|
||||
echo "Ansible repo(s) found"
|
||||
else
|
||||
echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && \
|
||||
[ ! -f /etc/olpc-release ]; then
|
||||
echo "Using OS package manager to check for ansible updates"
|
||||
apt-get -y update
|
||||
apt-get -y install ansible
|
||||
if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/olpc-release ]; then
|
||||
echo "Using apt to check for & install ansible updates"
|
||||
apt update
|
||||
apt -y install ansible
|
||||
fi
|
||||
|
||||
# needed?
|
||||
|
|
Loading…
Add table
Reference in a new issue