mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
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:
parent
7df0e5259f
commit
2a002f5c0b
3 changed files with 38 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue