# jenkins job config.xml

**URL:** <https://forum.ansible.com/t/jenkins-job-config-xml/38116>\
**Category:** Ansible Project\
**Created:** [June 16, 2023, 11:40pm UTC](https://forum.ansible.com/t/jenkins-job-config-xml/38116 "2023-06-16T23:40:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Narmada\_Karthika](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Narmada\_Karthika](https://forum.ansible.com/u/Narmada_Karthika)\
**Post date:** [June 16, 2023, 11:40pm UTC](https://forum.ansible.com/t/jenkins-job-config-xml/38116/1 "2023-06-16T23:40:24Z")

</div>

I have a jenkins job config.xml file, this is the template file, which will be replaced with the values from another yml file and next it has to create a jenkins job out of it. I am trying to figure out the best way to replace the values with the values from pipleine.yml file. could some one suggest better options.

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [June 17, 2023, 7:33am UTC](https://forum.ansible.com/t/jenkins-job-config-xml/38116/2 "2023-06-17T07:33:45Z")

</div>

[https://docs.ansible.com/ansible/latest/collections/community/general/xml\_module.html](https://docs.ansible.com/ansible/latest/collections/community/general/xml_module.html)

---

<div class="post-metadata">

**Author:** ![Narmada\_Karthika](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Narmada\_Karthika](https://forum.ansible.com/u/Narmada_Karthika)\
**Post date:** [June 19, 2023, 10:05pm UTC](https://forum.ansible.com/t/jenkins-job-config-xml/38116/3 "2023-06-19T22:05:47Z")

</div>

Thank you, by using the above module I am able to replace with the required value in one location, what if I want to replace with my required value in other locations in the same config.xml file?

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [June 19, 2023, 10:39pm UTC](https://forum.ansible.com/t/jenkins-job-config-xml/38116/4 "2023-06-19T22:39:40Z")

</div>

Please use template module - [https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template\_module.html](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html) to create a new pipeline.yml and then create jobs accordingly.

---

<div class="post-metadata">

**Author:** ![Narmada\_Karthika](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Narmada\_Karthika](https://forum.ansible.com/u/Narmada_Karthika)\
**Post date:** [June 21, 2023, 9:37pm UTC](https://forum.ansible.com/t/jenkins-job-config-xml/38116/5 "2023-06-21T21:37:03Z")

</div>

Thankyou Abhijeet, template module helped solve my issue. But as of now I am passing variables as --extra-vars to the command but I am looking for something where I can pass those variables with in the playbook instead of passing them manually.  
the variables are output of above task in the same playbook.
