diff --git a/Jenkinsfile b/Jenkinsfile index 16779d6..7a06bdd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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" + + } + } + } + } } } \ No newline at end of file