# ansible with jenkins pipeline

**URL:** <https://forum.ansible.com/t/ansible-with-jenkins-pipeline/26733>\
**Category:** Ansible Project\
**Created:** [February 14, 2018, 4:25pm UTC](https://forum.ansible.com/t/ansible-with-jenkins-pipeline/26733 "2018-02-14T16:25:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sidh](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Sidh](https://forum.ansible.com/u/Sidh)\
**Post date:** [February 14, 2018, 4:25pm UTC](https://forum.ansible.com/t/ansible-with-jenkins-pipeline/26733/1 "2018-02-14T16:25:49Z")

</div>

Hi,

Anyone using ansible with jenkins pipeline ?

Can you please point me to some documentation with examples ?

Regards,  
Sidh

---

<div class="post-metadata">

**Author:** ![Michael\_Bubb](https://avatars.discourse-cdn.com/v4/letter/m/f17d59/32.png) [@Michael\_Bubb](https://forum.ansible.com/u/Michael_Bubb)\
**Post date:** [February 15, 2018, 6:17pm UTC](https://forum.ansible.com/t/ansible-with-jenkins-pipeline/26733/2 "2018-02-15T18:17:41Z")

</div>

Are you familiar with groovy syntax? To play around you can setup a pipeline job and create stages for the steps that you want the job to handle.

here is an example stage where yu call a playbook with parameters

`stage('deploy') { if ("${DEPLOY_FLAG}" == "true") { // def SSH_KEY='<path>/deploy_id_rsa' def DEP_PLAYBOOK='<path>/deploy_app.yml' sh "ansible-playbook --private-key=${SSH_KEY} -b -e MY_WORKSPACE=${workspace} ${DEP_PLAYBOOK} -l ${DEPLOY_TARGET}" } }`

it works nicely and you can see the status of the stages on the job home page.

So an example job which builds and deploys might have stages where you

- pull from source mgmnt
- verify
- build
- build test
- deploy to canary
- sanity check
- deploy
- deploy verification
- tests …
- post deploy notification

All in one script -

Note in my example the conditional - you can set that either in the gui or in github post hooks etc. So the same pipeline file can handle build tests as well as deploys, etc

I would dive in and sandbox until yuo get comfortable
