File tree Expand file tree Collapse file tree 1 file changed +27
-6
lines changed Expand file tree Collapse file tree 1 file changed +27
-6
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- which ansible
4
-
5
- if [ $? -eq " 0" ]; then
6
- echo " ` ansible --version | head -1` - is already installed"
7
- exit
3
+ if [ -f /etc/os-release ]; then
4
+ osname=` grep ID /etc/os-release | egrep -v ' VERSION|LIKE|VARIANT' | cut -d' =' -f2 | sed -e ' s/"//' -e ' s/"//' `
5
+ echo $osname
8
6
else
7
+ echo " can not locate /etc/os-release - unable find the osname"
8
+ exit 8
9
+ fi
10
+
11
+ if [ $osname == " ubuntu" ]; then
12
+
9
13
clear
10
14
echo " No ansible installation found -- proceeding with ansible installation..."
11
15
sudo apt-get update
12
16
sudo apt-get install -y software-properties-common
13
17
sudo apt-add-repository --yes --update ppa:ansible/ansible
14
18
sudo apt-get install -y ansible
15
19
echo " ` ansible --version | head -1` installed Successfully"
20
+
21
+ elif [ $osname == " amzn" ]; then
22
+
23
+ clear
24
+ echo " No ansible installation found -- proceeding with ansible installation..."
25
+ sudo yum install -y epel-release
26
+ sudo yum install -y ansible
27
+ echo " ` ansible --version | head -1` installed Successfully"
28
+
29
+ elif [ $1 == " centos" ]; then
30
+
31
+ clear
32
+ echo " No ansible installation found -- proceeding with ansible installation..."
33
+ sudo yum install -y epel-release
34
+ sudo yum install -y ansible
35
+ echo " ` ansible --version | head -1` installed Successfully"
16
36
fi
17
- exit
37
+
38
+ exit 0
You can’t perform that action at this time.
0 commit comments