# How to split received multi valued variables from snow and run on a single template

**URL:** <https://forum.ansible.com/t/how-to-split-received-multi-valued-variables-from-snow-and-run-on-a-single-template/32597>\
**Category:** Ansible Project\
**Created:** [April 3, 2020, 11:22am UTC](https://forum.ansible.com/t/how-to-split-received-multi-valued-variables-from-snow-and-run-on-a-single-template/32597 "2020-04-03T11:22:39Z")\
**Posts on this page:** 1\
**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:** [April 3, 2020, 11:22am UTC](https://forum.ansible.com/t/how-to-split-received-multi-valued-variables-from-snow-and-run-on-a-single-template/32597/1 "2020-04-03T11:22:39Z")

</div>

Hi Team,

currently in my playbook I am using single valued variables hostname and domain,now I am getting variables mserver\_hostname and domain as multiple values from snow.  
like mserver\_hostname: 1.1.1.1, 2.2.2.2  
doamin: 3.3.3.3, 4.4.4.4  
how I can before passing split this and make two different set of variables in my playbook and use on a single template  
I mean like  
mserver\_hostname: 10.10.10.10  
doamin: 10.10.10.30  
and 2nd set like  
mserver\_hostname: 10.10.20.20  
doamin: 10.10.10.40

My playbooks are very complex and various roles are there and I already tried loops(with\_togather) but that is not appropriate for my playbook and tasks are failing

**My main objective is how to create create different set of variables from the received multi valued variables and use them into my playbook. on a single template**  
for ex- my login playbook -

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

- “{{ hostname }}”

- “{{ domain }}”

- debug:  
msg: " |~ +Failed+ Login failed to management server [{{ hostname }}] CODE:{{login.status}} ERROR: {{login.json.code}} - {{login.json.message}} |~"  
when: login.status != 200

- debug:  
msg: “Login successful to management server [{{ hostname }}]”  
when: login.status == 200
