Introduce 'changed_when' keyword to override a task's changed status with the evaluation of a Jinja2 expression

This commit is contained in:
Stoned Elipot 2013-07-14 21:07:45 +02:00
parent 81940c8b11
commit eb45f07ae3
5 changed files with 75 additions and 6 deletions

View file

@ -351,7 +351,7 @@ class PlayBook(object):
# extra vars need to always trump - so update again following the facts
self.SETUP_CACHE[host].update(self.extra_vars)
if task.register:
if 'stdout' in result:
if 'stdout' in result and 'stdout_lines' not in result:
result['stdout_lines'] = result['stdout'].splitlines()
self.SETUP_CACHE[host][task.register] = result
@ -359,7 +359,7 @@ class PlayBook(object):
if task.ignore_errors and task.register:
failed = results.get('failed', {})
for host, result in failed.iteritems():
if 'stdout' in result:
if 'stdout' in result and 'stdout_lines' not in result:
result['stdout_lines'] = result['stdout'].splitlines()
self.SETUP_CACHE[host][task.register] = result