ansible/ansible — pull request #6674 by antlegrand (2014-03-25 09:59:58+00:00)
Title: Add register_as_list/hash

cleaner version of: https://github.com/ansible/ansible/pull/6488

Added 2 new keywords:

register_as_list: boolean
register_as_dict: hashkey
They both require the 'register' keyword to be present.
Its define the data structure,

register_as_list: yes => appends the result to a list
register_as_dict: key => adds the result to a hash[key]

exemple:
```yaml
- name: Append result in a list
template: src= a.conf.j2 dest=/root/a.conf backup=yes
register: foo_list
register_as_list: yes

- name: template1
template: src=mytpl1.conf.j2 dest=/root/mytpl1.conf backup=yes
register: bar_dict
register_as_dict: key1

- name: template2
template: src=mytpl2.conf.j2 dest=/root/mytpl2.conf backup=yes
register: bar_dict
register_as_dict: key2
```

use the registred results:

```yaml
- name: display results (register_as_list)
debug: msg={{item}}
with_items: foo_list

- name: display result template1
debug: msg={{bar_dict['key1']}}
```