Ansible and Jenkins integration

91 views
Skip to first unread message

vu001

unread,
Mar 1, 2017, 10:00:01 AM3/1/17
to Ansible Project
Hi to all!

I would like to integrate Ansible and Jenkins using ansible plugin from Jenkins. 
Is it possible to run Ansible commands on remote host from Jenkins, or the idea of Ansible plugin for Jenkins is that both of them are on the same server.
To simplify, Jenkins is on server1, Ansible is on server2. Is it possible, using Ansible plugin for Jenkins, to run ansible commands on server2 where is Ansible from Jenkins (I already done this with shell commands) 

Thanks a lot.

ishan jain

unread,
Mar 2, 2017, 4:27:54 AM3/2/17
to Ansible Project
I would suggest that you add server2 as a slave in your Jenkins. Create a Jenkins job, configure it to run on this slave and specify the Ansible commands in the build step just like you execute any other shell command.

vu001

unread,
Mar 2, 2017, 10:16:10 AM3/2/17
to Ansible Project
Thank you...that is one solution for my problem...I've tested it and works fine

Ted Zlatanov

unread,
Mar 2, 2017, 1:49:20 PM3/2/17
to ansible...@googlegroups.com
On Thu, 2 Mar 2017 01:27:54 -0800 (PST) ishan jain <ishan...@gmail.com> wrote:

ij> I would suggest that you add server2 as a slave in your Jenkins. Create a
ij> Jenkins job, configure it to run on this slave and specify the Ansible
ij> commands in the build step just like you execute any other shell command.

Also note that an Ansible playbook can be turned into a shell script easily.

```
#!/usr/bin/ansible-playbook

- hosts: localhost
tasks:
- debug: var=item
with_items: "{{ [ 1, 2, 3 ] }}"
```

Ted

vu001

unread,
Mar 3, 2017, 6:16:13 AM3/3/17
to Ansible Project, t...@lifelogs.com
Thank you Ted, this is also useful, not for this particular purpose, but useful...
Reply all
Reply to author
Forward
0 new messages