Created
November 18, 2016 13:52
-
-
Save gbersac/ca49a109070bedb4023ee1cccca9fd7b to your computer and use it in GitHub Desktop.
Creation d'un fichier rpm et installation dans un host distant
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
#! /bin/sh | |
# You have to be at the root of the package of the project from which you | |
# want to install the rpm | |
projectName=api_intranet | |
projectNameLong=intranet-parcel-defect-process | |
target="ftops-recette-apiserverintranet-a-01.archinext.local" | |
# Create rpm | |
cat version.sbt | tr - _ > temp && mv temp version.sbt | |
sbt "project $projectName" "rpm:packageBin" | |
cat version.sbt | tr _ - > temp && mv temp version.sbt | |
# Copy file to distant host | |
cd $projectName/target/rpm/RPMS/noarch/ | |
fileName=`ls | grep $projectNameLong` | |
echo "Transfer of file: $fileName" | |
scp $fileName ansible@$target:/tmp | |
cd - | |
# Install on distant host | |
ssh -tt ansible@$target 'sudo yum -y remove `yum list installed | grep $projectNameLong`' | |
ssh -tt ansible@$target "sudo yum -y install /tmp/$fileName" | |
ssh -tt ansible@$target "sudo /etc/init.d/$projectNameLong restart" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment