Ansible + Jenkins

571 views
Skip to first unread message

Alex T

unread,
Nov 13, 2014, 3:27:53 AM11/13/14
to ansible...@googlegroups.com
Hi! 
Everybody knows, how to run ansible playbook from jenkins ci?

Torsten Reinhard

unread,
Nov 15, 2014, 3:47:13 AM11/15/14
to ansible...@googlegroups.com
Hi,
 
why dont use a “Shell” Buildstep and inside just do:
 
ansible-playbook –i /path/to/hosts playbook.yml –v –extra-vars ..... and so on?
 
Of course you need an Ansible installation on your system, first.
 
That´s the way how I´ve setup this – and all playbooks are executed immediately after a SVN commit – running against local virtual environments.
 
Regards, Torsten
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fd43f237-4bf9-4913-a442-5c7e8c44b09d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

J Hawkesworth

unread,
Nov 17, 2014, 9:03:27 AM11/17/14
to ansible...@googlegroups.com
You can use 'Publish over SSH' module to call a remote system running ansible.
Configure your ansible host in Jenkins -> Manage Jenkins -> Configure System
Then you can add a post build action called 'Send Build artifacts over ssh'.  Select your ansible host and then in the Transfers section, specify commands to run on your ansible host.  You don't actually have to transfer files with this action.

Manuel Jesús Recena Soto

unread,
Nov 17, 2014, 12:05:47 PM11/17/14
to ansible...@googlegroups.com
Hello Alex,

As Torsten said you, you can use "Shell buildstep" and invoke your
playbook (Ansible).
At ClinkerHQ (Hosted CI service based on Jenkins) you can available
Ansible Playbook.

Disclaimer: I work at ClinkerHQ.

Regards,
> https://groups.google.com/d/msgid/ansible-project/18684390802C4A8D9689089F90394B39%40SamsungRF710.
>
> For more options, visit https://groups.google.com/d/optout.



--
Manuel Jesús Recena Soto
Founder, CEO & CTO of klicap - ingeniería del puzle

mobile phone +34 664 000 629
work phone + 34 954 894 322
www.klicap.es | blog.klicap.es

Michael DeHaan

unread,
Nov 17, 2014, 3:39:54 PM11/17/14
to ansible...@googlegroups.com
An alternative, which you may like, is to install Ansible Tower, and then use ansible-tower-cli in your shell step.

It makes integration with Jenkins a one liner.

It will get you nicer output, particularly for a larger number of hosts, than Jenkins, and also some nice ways to edit inventory and identify problems.



Azul Inho

unread,
Dec 5, 2014, 12:50:01 PM12/5/14
to ansible...@googlegroups.com
I use jenkins heavily for orchestration, in a setup where I have multiple jenkins CD pipelines in different environments all deploying code using Ansible.

See this setup below, it's an example for deploying jenkins, setting up the jobs and dependencies.
It also shows how to provisioning and configure a zabbix box using Ansible executed from a jenkins job,
you should be able to adapt it to execute anything you like

https://github.com/Azulinho/ansible-jenkins-showcase

Michael DeHaan

unread,
Dec 5, 2014, 8:57:20 PM12/5/14
to ansible...@googlegroups.com
or check out Tower :)



abraham

unread,
Sep 15, 2015, 9:14:54 AM9/15/15
to Ansible Project
i configure like as below for ci

1)i configured  Jenkins,maven and git
2) In that .war file to upload to  S3 bucket uisng publish artifacts to s3 bucket plugin
3) create new EC2 instance using cloud formation template from S3 bucket using cloud formation plugin
4) now i want to configure Ansible plugin in jenkins how to configure please help me ...
Reply all
Reply to author
Forward
0 new messages