srv-stage/instsrv.sh

41 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# if you are a problem to push the repo. Run 'git config http.postBuffer 524288000'
# install requirements
dnf install epel-release ftp python3-pip tar git -y
dnf install python3-passlib -y
# config git (use only if we must commit a modification)
git config --global user.name "Gilles Mouchet"
git config --global user.email "gilles.mouchet@gmail.com"
# check if proxy vdg exist
ping -c2 proxy.ville-geneve.ch > /dev/null 2>&1 #2>&1 >/dev/null
if [ "$?" -eq "0" ]; then
echo "Proxy exist"
export https_proxy=http://proxy.ville-geneve.ch:8080
set_proxy=true
else
echo "No proxy exist"
set_proxy=false
fi
# insatll ansible and requirements
echo "Install ansible and requirements. Please wait ..."
pip3 install --upgrade pip > /dev/null 2>&1
pip3 install ansible requests==2.31.0 docker==6.1.3 docker-compose > /dev/null 2>&1
# pip3 install ansible requests docker docker-compose requests==2.31.0 > /dev/null 2>&1
echo "Install ansible community and docker collection"
#ansible-galaxy collection install community.docker > /dev/null 2>&1
ansible-galaxy collection install community.docker community.general --force > /dev/null 2>&1
unset https_proxy
# disable firewalld
systemctl stop firewalld
systemctl disable firewalld
# insatll server
ansible-playbook main.yml -e proxy=$set_proxy