Support iteration over command output in with_items.

When the output of a command is stored in a register, this will create a
stdout_lines field in the result object that contains stdout split into a list
of lines.  This list can then be iterated over using with_items.
This commit is contained in:
John Kleint 2012-09-17 16:57:33 -04:00
commit 2a002f5c0b
3 changed files with 38 additions and 0 deletions

View file

@ -258,6 +258,8 @@ class PlayBook(object):
facts = result.get('ansible_facts', {})
self.SETUP_CACHE[host].update(facts)
if task.register:
if 'stdout' in result:
result['stdout_lines'] = result['stdout'].splitlines()
self.SETUP_CACHE[host][task.register] = result
# flag which notify handlers need to be run