# How to pass params from Ansible to Jenkins Job triggered by Ansible Playbook?

**URL:** <https://forum.ansible.com/t/how-to-pass-params-from-ansible-to-jenkins-job-triggered-by-ansible-playbook/32881>\
**Category:** Ansible Project\
**Created:** [May 7, 2020, 7:53pm UTC](https://forum.ansible.com/t/how-to-pass-params-from-ansible-to-jenkins-job-triggered-by-ansible-playbook/32881 "2020-05-07T19:53:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mimo](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@Mimo](https://forum.ansible.com/u/Mimo)\
**Post date:** [May 7, 2020, 7:53pm UTC](https://forum.ansible.com/t/how-to-pass-params-from-ansible-to-jenkins-job-triggered-by-ansible-playbook/32881/1 "2020-05-07T19:53:50Z")

</div>

Hello everyone,

I checked Ansible documentation, I did not find answers there or anywhere of how I can pass params to the Jenkins Job,so these params should be as an input params to this Jenkins Job and they will be used in that Job, So is there a way to make this happen?

Thank you already for your answers

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [May 7, 2020, 8:02pm UTC](https://forum.ansible.com/t/how-to-pass-params-from-ansible-to-jenkins-job-triggered-by-ansible-playbook/32881/2 "2020-05-07T20:02:19Z")

</div>

Hi,

In order to push jobs from Ansible or even Python to Jenkins you need to make sure Remote Trigger is enable and an API Token has been created for your Jenkins User. You can Then just use a Post request using the Ansible URI module

---

<div class="post-metadata">

**Author:** ![Mimo](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@Mimo](https://forum.ansible.com/u/Mimo)\
**Post date:** [May 7, 2020, 8:33pm UTC](https://forum.ansible.com/t/how-to-pass-params-from-ansible-to-jenkins-job-triggered-by-ansible-playbook/32881/3 "2020-05-07T20:33:25Z")

</div>

can you explain in more details please? it is not clear to me

---

<div class="post-metadata">

**Author:** ![Mimo](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@Mimo](https://forum.ansible.com/u/Mimo)\
**Post date:** [May 7, 2020, 8:44pm UTC](https://forum.ansible.com/t/how-to-pass-params-from-ansible-to-jenkins-job-triggered-by-ansible-playbook/32881/4 "2020-05-07T20:44:26Z")

</div>

it is not clear how to make the params as input there, it is easy to make it through Jenkins pipelines, but I am using Ansible, so I am expecting to have a Jenkins module that will build a job in Jenkins (or in my case handle the params to already existing job in Jenkins

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [May 7, 2020, 9:08pm UTC](https://forum.ansible.com/t/how-to-pass-params-from-ansible-to-jenkins-job-triggered-by-ansible-playbook/32881/5 "2020-05-07T21:08:12Z")

</div>

```auto
Using the Example Curl -X you can use the Ansible URI Module curl -X POST http://developer:developer@localhost:8080/job/test/buildWithParameter --data-urlencode json='{"parameter": [{"name":"paramA", "value":"123"}]}'---
  - name: Jenkins Remote Build 
    hosts: localhost
    connection: local
    tasks:
    - name: Adding Virtual Machine to Blackout
      uri:
        url: http://developer:developer@localhost:8080/job/test/buildWithParameter
        method: POST
        body_format: JSON
        body:
        "{\"parameter\": [{\"name\":\"Test\"}, {\"vaule\":\"123\"}]} status_code: 200

```
