Skip to content

Commit

Permalink
Update installAnsible.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
lerndevops authored Aug 12, 2020
1 parent e236dac commit b6604ba
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions ansible/install/installAnsible.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
#!/bin/bash

which ansible

if [ $? -eq "0" ];then
echo "`ansible --version | head -1` - is already installed"
exit
if [ -f /etc/os-release ];then
osname=`grep ID /etc/os-release | egrep -v 'VERSION|LIKE|VARIANT' | cut -d'=' -f2 | sed -e 's/"//' -e 's/"//'`
echo $osname
else
echo "can not locate /etc/os-release - unable find the osname"
exit 8
fi

if [ $osname == "ubuntu" ];then

clear
echo "No ansible installation found -- proceeding with ansible installation..."
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt-get install -y ansible
echo "`ansible --version | head -1` installed Successfully"

elif [ $osname == "amzn" ]; then

clear
echo "No ansible installation found -- proceeding with ansible installation..."
sudo yum install -y epel-release
sudo yum install -y ansible
echo "`ansible --version | head -1` installed Successfully"

elif [ $1 == "centos" ];then

clear
echo "No ansible installation found -- proceeding with ansible installation..."
sudo yum install -y epel-release
sudo yum install -y ansible
echo "`ansible --version | head -1` installed Successfully"
fi
exit

exit 0

0 comments on commit b6604ba

Please sign in to comment.