# Iterate a dict over loop: different key value pair

**URL:** <https://forum.ansible.com/t/iterate-a-dict-over-loop-different-key-value-pair/25302>\
**Category:** Ansible Developer\
**Created:** [August 22, 2017, 3:53am UTC](https://forum.ansible.com/t/iterate-a-dict-over-loop-different-key-value-pair/25302 "2017-08-22T03:53:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahul\_raviz](https://avatars.discourse-cdn.com/v4/letter/r/e9bcb4/32.png) [@rahul\_raviz](https://forum.ansible.com/u/rahul_raviz)\
**Post date:** [August 22, 2017, 3:53am UTC](https://forum.ansible.com/t/iterate-a-dict-over-loop-different-key-value-pair/25302/1 "2017-08-22T03:53:40Z")

</div>

Is there any way to iterate over a dict with different key - value pair in ansible?

Suppose I have a dict like below:

---

<div class="post-metadata">

**Author:** ![Gregory\_Dulin](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@Gregory\_Dulin](https://forum.ansible.com/u/Gregory_Dulin)\
**Post date:** [October 6, 2017, 2:47am UTC](https://forum.ansible.com/t/iterate-a-dict-over-loop-different-key-value-pair/25302/2 "2017-10-06T02:47:04Z")

</div>

Rahul,

Right now, **packages** is a _list_ with 2 items, and each item is a _dict_ with one key/value pair.

If you’re the one generating **packages** , I’d rewrite it as a _dict_:

`
