Add remote execution
This commit is contained in:
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@@ -15,5 +15,23 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage("execute ansible playbook") {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
echo "calling ansible playbook to configure ec2 instances"
|
||||||
|
def remote = [:]
|
||||||
|
remote.name = "ansible-server"
|
||||||
|
remote.host = "167.99.136.157"
|
||||||
|
remote.allowAnyHosts = true
|
||||||
|
|
||||||
|
withCredentials([sshUserPrivateKey(credentialsId: 'ansible-server-key', keyFileVariable: 'keyfile', usernameVariable: 'user')]){
|
||||||
|
remote.user = user
|
||||||
|
remote.identityFile = keyfile
|
||||||
|
sshCommand remote: remote, command: "ls -l"
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user