# how to  divide bulk dynamic  chunk data in to small chunks and pass  from ansible to API

**URL:** <https://forum.ansible.com/t/how-to-divide-bulk-dynamic-chunk-data-in-to-small-chunks-and-pass-from-ansible-to-api/33005>\
**Category:** Ansible Project\
**Created:** [May 22, 2020, 9:18am UTC](https://forum.ansible.com/t/how-to-divide-bulk-dynamic-chunk-data-in-to-small-chunks-and-pass-from-ansible-to-api/33005 "2020-05-22T09:18:55Z")\
**Posts on this page:** 2\
**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:** [May 22, 2020, 9:18am UTC](https://forum.ansible.com/t/how-to-divide-bulk-dynamic-chunk-data-in-to-small-chunks-and-pass-from-ansible-to-api/33005/1 "2020-05-22T09:18:55Z")

</div>

Hi Team  
Please help me how to divide bulk chunk data in to small chunks so small chunks update to the snow api.

below is my playbook and my data is in EPG\_all variable there would be some 5000 lines of data .  
how i can divide this data into small chunks and pass to snow table .

- name: Query all EPGs  
aci\_epg:  
host: “{{hostname}}”  
username: “{{user}}”  
password: “{{pass}}”  
validate\_certs: no  
use\_proxy: no  
state: query  
delegate\_to: localhost  
register: result

- set\_fact:  
EPG: “{{ result | to\_json }}”

- set\_fact:  
EPG\_all: “{{ result | json\_query(‘current[\*].fvAEPg.attributes.dn’)| list | sort }}”

- debug:  
var: EPG\_all

- name: Passing Data to Snow  
uri:  
url: “[https://testing1.service-now.com/api/eplc/update\_integration/create](https://testing1.service-now.com/api/eplc/update_integration/create)”  
method: POST  
body: ‘{“List”:{{EPG\_all}}, “Region”:“NA - test” }’  
body\_format: json  
user: “{{ snow\_user }}”  
password: “{{ snow\_pass }}”  
force\_basic\_auth: yes  
status\_code: 200  
timeout: 100

appreciate your help in advanced

---

<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:** [May 26, 2020, 10:49am UTC](https://forum.ansible.com/t/how-to-divide-bulk-dynamic-chunk-data-in-to-small-chunks-and-pass-from-ansible-to-api/33005/2 "2020-05-26T10:49:15Z")

</div>

This can be done like below-  
Batch : “{{ EPG\_all|batch(100)|list }}”
