-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_ansible_installed.sh
47 lines (45 loc) · 1.77 KB
/
check_ansible_installed.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# ------------------------------------------------------------------------ #
# Script Name: firewalld.sh
# Description: Firewalld service management
# Site: https://medium.com/@amaurybsouza
# Written by: Amaury Souza
# Maintenance: Amaury Souza
# ------------------------------------------------------------------------ #
# Usage:
# $ ./firewalld.sh
# ------------------------------------------------------------------------ #
# Tested on:
# Bash 4.2.46
# ------------------------------------------------------------------------ #
# History: v1.0 25/05/2020, Amaury:
# - Start de program
# - Add case feature
# v1.1 25/05/2020, Amaury:
# - Adding new variables
# v1.2 25/05/2020, Amaury:
# - Executing new tests in my system
# ------------------------------------------------------------------------ #
# Thankfulness:
#
# ------------------------------------------------------------------------ #
#VARIABLES --------------------------------------------------------------- #
#REQUIRED_PKG="ansible"
#CHECK_PKG=`dpkg -s ansible`
#CODE -------------------------------------------------------------------- #
#echo -ne "Checking if the $REQUIRED_PKG is present on the systems"
if ansible --version >/dev/null 2>&1; then
echo Found
sleep 3
echo "Checking the version..."
sleep 3
ansible --version | grep -i "ansible 2."
else
echo Not found
sleep 3
echo "Installing the Ansible package..."
sleep 3
echo "Updating the system..."
sudo apt update && sudo apt upgrade -y
sudo apt install software-properties-common -y && sudo add-apt-repository --yes --update ppa:ansible/ansible && sudo apt install ansible -y
fi