Ansible and Jenkins integration

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.

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.

Thank you…that is one solution for my problem…I’ve tested it and works fine

Dana četvrtak, 2. ožujka 2017. u 10:27:54 UTC+1, korisnik ishan jain napisao je:

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

Thank you Ted, this is also useful, not for this particular purpose, but useful…

Dana četvrtak, 2. ožujka 2017. u 19:49:20 UTC+1, korisnik Ted Zlatanov napisao je: