how to update list of dicts in playbook?

Hello,

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

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

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.:

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

Did you try http://docs.ansible.com/ansible/latest/playbooks_filters.html#combining-hashes-dictionaries ?