ansible/ansible — pull request #9735 by herbyg-axial (2014-12-06 08:36:15+00:00)
Title: Add with_allocate: allocate a list items over a list of "slots"

Given some list of hosts for example, it would be useful to have a simple way to distribute them into a given set of networks or zones. with_allocate provides Ansible with a loop feature for doing this. It takes the list of things to distribute into as a `slots` parameter, and allocates the given items in the `items` parameter into each slot in round-robin fashion.

Returns results in the format:
```
" {{ item.current }} {{ item.slot }}"
```
Example:
```
- debug: msg="{{ item.current }} is in {{ item.slot }}"
with_allocate:
slots:
- "zone1"
- "zone2"
items:
- "my_server1"
- "my_server2"
- "my_server3"
- "my_server4"
- "my_server5"
```