Permalink
Browse files

with_items flatten list of lists #5913

  • Loading branch information...
ko-zu committed Feb 9, 2014
1 parent 3f2f5fe commit 0a1a5cde86df0424441b78dd9e67b96159cfd70f
Showing with 11 additions and 0 deletions.
  1. +11 −0 docsite/rst/playbooks_loops.rst
@@ -43,6 +43,17 @@ If you have a list of hashes, you can reference subkeys using things like::
- { name: 'testuser1', groups: 'wheel' }
- { name: 'testuser2', groups: 'root' }
+For historical reasons, 'with_items' flatten supplied list if it contains lists.
+If you want to iterate for each lists as `item`, you need wrap the list of lists. like::

This comment has been minimized.

Show comment
Hide comment
@dirtyharrycallahan

dirtyharrycallahan Feb 9, 2014

Did you intend to have two colons at the end of the line?

@dirtyharrycallahan

dirtyharrycallahan Feb 9, 2014

Did you intend to have two colons at the end of the line?

+
+ - name: add several users
+ user: name={{ item.0 }} state=present groups={{ item.1 }}
+ with_items:
+ -
+ - [ 'testuser1', 'wheel' ]
+ - [ 'testuser2', 'root' ]
+
+
.. _nested_loops:
Nested Loops

0 comments on commit 0a1a5cd

Please sign in to comment.