Add jenkinsfile for ansible execution
This commit is contained in:
37
Jenkinsfile
vendored
37
Jenkinsfile
vendored
@@ -1,36 +1,17 @@
|
||||
def gv
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage("init") {
|
||||
stage("copy files to ansible server") {
|
||||
steps {
|
||||
script {
|
||||
gv = load "script.groovy"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("build jar") {
|
||||
steps {
|
||||
script {
|
||||
echo "building jar"
|
||||
//gv.buildJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("build image") {
|
||||
steps {
|
||||
script {
|
||||
echo "building image"
|
||||
//gv.buildImage()
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("deploy") {
|
||||
steps {
|
||||
script {
|
||||
echo "deploying"
|
||||
//gv.deployApp()
|
||||
echo "copying all neccessary files to ansible control node"
|
||||
sshagent(['ansible-server-key']) {
|
||||
sh "scp -o StrictHostKeyChecking=no ansible/* root@167.99.136.157:/root"
|
||||
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-server-key', keyFileVariable: 'keyfile', usernameVariable: 'user')]) {
|
||||
sh "scp ${keyfile} root@167.99.136.157:/root/ssh-key.pem"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user