# how to pass same  variable value multiple times in a list

**URL:** <https://forum.ansible.com/t/how-to-pass-same-variable-value-multiple-times-in-a-list/33126>\
**Category:** Ansible Project\
**Created:** [June 9, 2020, 9:59am UTC](https://forum.ansible.com/t/how-to-pass-same-variable-value-multiple-times-in-a-list/33126 "2020-06-09T09:59:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diyawary](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Diyawary](https://forum.ansible.com/u/Diyawary)\
**Post date:** [June 9, 2020, 9:59am UTC](https://forum.ansible.com/t/how-to-pass-same-variable-value-multiple-times-in-a-list/33126/1 "2020-06-09T09:59:46Z")

</div>

Hi Team,

I am using with\_togather so i have two list one is mserver and other is domain, problem is i want to pass same mserver two times in the list ,but it is giving error and using only last defined value.

My requirement is for mserver list this can be same mserver or sometimes different mservers - name: Login to Checkpoint Management Server  
uri:  
url: “https://{{item.0}}/web\_api/login”  
validate\_certs: False  
method: POST  
body:  
user: “{{ mserver\_username }}”  
password: “{{ mserver\_password }}”  
domain: “{{item.1}}”  
body\_format: json  
register: login  
failed\_when: False  
when: item.0 != “” and item.1 != “”  
mserver: {10,10,10,10, 10.10.10.10, 20.20.20.20}  
doamin:{9.9.9.9,8.8.8.8,7.7.7.7}  
and i want execute like when mserver 10.10.10.10 then domain is 9.9.9.9  
and again mserver is 10.10.10.10 and domain is 8.8.8.8 so on. and this two list mserver and domain I will get dynamically.  
my playboolk

tasks:

- include\_role:  
name: validateip  
when: object\_type == “ip”  
with\_together:
- “{{ mserver }}”
- “{{ domain }}”

and in this role there are multiple tasks like login ,validation and logout I am performing  
for ex login playbook

- name: Login to Checkpoint Management Server  
uri:  
url: “https://{{item.0}}/web\_api/login”  
validate\_certs: False  
method: POST  
body:  
user: “{{username }}”  
password: “{{ password }}”  
domain: “{{item.1}}”  
body\_format: json  
register: login  
failed\_when: False  
when: item.0 != “” and item.1 != “”

please help how to pass same values in list.

---

<div class="post-metadata">

**Author:** ![Diyawary](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Diyawary](https://forum.ansible.com/u/Diyawary)\
**Post date:** [June 10, 2020, 6:54am UTC](https://forum.ansible.com/t/how-to-pass-same-variable-value-multiple-times-in-a-list/33126/2 "2020-06-10T06:54:41Z")

</div>

Could any one please help on it. is there any way how to use same items multiple times in a list . Appreciate your help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [June 10, 2020, 8:36pm UTC](https://forum.ansible.com/t/how-to-pass-same-variable-value-multiple-times-in-a-list/33126/3 "2020-06-10T20:36:01Z")

</div>

mserver and domain are not lists, lists use as delimiters not { }

---

<div class="post-metadata">

**Author:** ![Diyawary](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Diyawary](https://forum.ansible.com/u/Diyawary)\
**Post date:** [June 12, 2020, 11:32am UTC](https://forum.ansible.com/t/how-to-pass-same-variable-value-multiple-times-in-a-list/33126/4 "2020-06-12T11:32:41Z")

</div>

Thank You so much Brain.
