forked from lerndevops/labs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lerndevops
authored
Aug 12, 2020
1 parent
e236dac
commit b6604ba
Showing
1 changed file
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
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 |