### Input Declaration
targetHost=localhost
targerFolderPath=/opt/raghu/gateway
sourceFolderPath=/tmp
ansibleInstallerPath=/opt/raghu
pythonInstallerPath=/opt/raghu
### Main Code
### Check existance of gateway file and copy
if [ -d $targerFolderPath ]; then
echo "$targerFolderPath exist"
#Copy all the content from engine & paste all the remote gateway
sshpass -p "Pass@123" scp -r /tmp root@localhost:/opt/raghu/gateway
if command -v python3.6 &>/dev/null; then
echo Python 3 is already installed
exit 1
else
echo Python 3 is not installed
yum install gcc openssl-devel bzip2-devel -y
cd /usr/src
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
tar xzf Python-3.6.8.tgz
cd Python-3.6.8
./configure --enable-optimizations
make altinstall
rm /usr/src/Python-3.6.8.tgz
if command -v python3.6 &>/dev/null; then
echo Python 3 is installed
if command -v ansible &>/dev/null; then
echo anisble is already installed
exit 1
else
echo ansible is not installed
echo installing ansible
pip3.6 install ansible
if command -v ansible &>/dev/null; then
echo installed ansible
exit 1
else
echo unable to install ansible by automation
exit 1
fi
fi
else
echo Unable to install python3 by automation
exit 1
fi
fi
else
echo "$targerFolderPath does not exist"
mkdir -p /opt/raghu/gateway;
#Copy all the content from engine & paste all the remote gateway\
sshpass -p "Pass@123" scp -r /tmp root@localhost:/opt/raghu/gateway
if [ -d $targerFolderPath ]; then
echo "created gatewayfolder"
if command -v python3.6 &>/dev/null; then
echo Python 3 is already installed
exit 1
else
echo Python 3 is not installed
yum install gcc openssl-devel bzip2-devel -y
cd /usr/src
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
tar xzf Python-3.6.8.tgz
cd Python-3.6.8
./configure --enable-optimizations
make altinstall
rm /usr/src/Python-3.6.8.tgz
if command -v python3.6 &>/dev/null; then
echo Python 3 is installed
if command -v ansible &>/dev/null; then
echo anisble is already installed
exit 1
else
echo ansible is not installed
echo installing ansible
pip3.6 install ansible
if command -v ansible &>/dev/null; then
echo installed ansible
exit 1
else
echo unable to install ansible by automation
exit 1
fi
fi
else
echo Unable to install python3 by automation
exit 1
fi
fi
else
echo unable to create gateway via automation
exit 1
fi
fi
No comments:
Post a Comment