# how to update list of dicts in playbook?

**URL:** <https://forum.ansible.com/t/how-to-update-list-of-dicts-in-playbook/25011>\
**Category:** Ansible Project\
**Created:** [July 18, 2017, 10:46am UTC](https://forum.ansible.com/t/how-to-update-list-of-dicts-in-playbook/25011 "2017-07-18T10:46:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Riccardo\_Murri](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Riccardo\_Murri](https://forum.ansible.com/u/Riccardo_Murri)\
**Post date:** [July 18, 2017, 10:46am UTC](https://forum.ansible.com/t/how-to-update-list-of-dicts-in-playbook/25011/1 "2017-07-18T10:46:19Z")

</div>

Hello,

I would like to write a playbook that does the following:

1. Read a list of source URLs + other meta-data, e.g.:

```auto
sources:
  - name: CentOS 6
    source: http://cloud.centos.org/centos/6/images/CentOS-6-x86_64-GenericCloud.qcow2
    user: centos
  - name: Debian 8
    source: http://cdimage.debian.org/cdimage/openstack/current-8/debian-8-openstack-amd64.qcow2
    user: debian

```

2. Download each item in the list, then run a command on each  
downloaded file (`glance image-create ...`)  
3. Extract the UUIDs from the outputs in 2., build a list of UUIDs and  
meta-data from 1., and then run another task or playbook on the  
resulting list. The input vars to this new playbook would look like  
e.g.:

```auto
images:
  - uuid: 334d4039-8c5b-4e6b-b638-05702d2d2ba7
    name: CentOS 6
    user: centos
  - uuid: 06bac813-d089-4fb7-bd30-fdabdc9febb2
    name: Debian 8
    user: debian

```

In other words, is there a way I can grab a list of dict's, add/modify  
some fields in every dict, and set/register the resulting list as  
input to another task or play? Should I rather write a Python script  
to do this?

Thanks for any suggestion!

Riccardo

---

<div class="post-metadata">

**Author:** ![Mathias\_Ettinger](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@Mathias\_Ettinger](https://forum.ansible.com/u/Mathias_Ettinger)\
**Post date:** [July 20, 2017, 11:09am UTC](https://forum.ansible.com/t/how-to-update-list-of-dicts-in-playbook/25011/2 "2017-07-20T11:09:57Z")

</div>

Did you try [http://docs.ansible.com/ansible/latest/playbooks\_filters.html#combining-hashes-dictionaries](http://docs.ansible.com/ansible/latest/playbooks_filters.html#combining-hashes-dictionaries) ?
