I have ansible engine running on server 1 and Jenkins running on server2. Is there a way to execute the playbook from the Jenkins server using any of the plugins.
Asked
Active
Viewed 2,031 times
1 Answers
0
Can you login to Server1(Ansible) from Server2 (Jenkins) using SSH and execute command ansible? Or can Server1(Ansible) be converted into a Jenkins Slave, connect it with Jenkins (Server2) and configure your job to run on Server1 where ansible is installed.

saurabh14292
- 1,281
- 2
- 10
- 12
-
So the First approach which you are suggesting is like using "Execute shell on remote server" and In the second approach we will have an extra overhead of having a slave Jenkins. Is there any Better or efficient way? – saket thaploo Mar 27 '20 at 12:00
-
Yes, either user "Execute shell on remote server" or execute ssh command using "Execute Shell". If you are using Jenkins Pipeline, you can use "sh"/"sshagent" under "steps". Something like mentioned below GitHub repo: https://gist.github.com/mrhockeymonkey/adf7a462982340cdad2ef4f65b481227 Better approach is having Ansible installed on Jenkins server itself :) – saurabh14292 Mar 27 '20 at 12:26