# using mutiple times same values

**URL:** <https://forum.ansible.com/t/using-mutiple-times-same-values/26338>\
**Category:** Ansible Project\
**Created:** [December 20, 2017, 11:56am UTC](https://forum.ansible.com/t/using-mutiple-times-same-values/26338 "2017-12-20T11:56:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![coach.rhca](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@coach.rhca](https://forum.ansible.com/u/coach.rhca)\
**Post date:** [December 20, 2017, 11:56am UTC](https://forum.ansible.com/t/using-mutiple-times-same-values/26338/1 "2017-12-20T11:56:59Z")

</div>

I am trying to create multiple different directory structure using the with\_items and again i need to refer the same directory structure in the other plays in the playbook.

for example

- file: name=/jenkins/data/{{item.dir1}}/{{item.dir2}}  
with\_items:
- {dir1: str-build, dir2: gitconfig\_dev}
- {dir1: btr-build, dir2: gitconfig\_test}
- {dir1: ctr-build, dir2: gitconfig\_test6}  
…  
there are around 20 items like this  
…  
same variable i need to refer in the other play like
- git: repo=[http://github/](http://github/)… dest=/jenkins/data/{{item1.dir1}}/{{item.dir2}} clone=yes  
with\_items:
- {dir1: str-build, dir2: gitconfig\_dev}
- {dir1: btr-build, dir2: gitconfig\_test}
- {dir1: ctr-build, dir2: gitconfig\_test6}

Again in some other play …so how do i make this **global** so that we define once **with\_items** and use it in all the other play…  
thank you.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [December 20, 2017, 2:54pm UTC](https://forum.ansible.com/t/using-mutiple-times-same-values/26338/2 "2017-12-20T14:54:54Z")

</div>

Add it in a variable in group\_vars/all.yml then it's global.

all.yml

---

<div class="post-metadata">

**Author:** ![coach.rhca](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@coach.rhca](https://forum.ansible.com/u/coach.rhca)\
**Post date:** [December 21, 2017, 4:00am UTC](https://forum.ansible.com/t/using-mutiple-times-same-values/26338/3 "2017-12-21T04:00:51Z")

</div>

thanks Kai, i will check this one…thanks a bunch
