Modified 'ok' to 'changed' when a change has occured

pull/1081/head
Dane Summers 12 years ago
parent 3939f7a812
commit 04c535b1e9

@ -310,6 +310,10 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
host_result2 = host_result.copy() host_result2 = host_result.copy()
host_result2.pop('invocation', None) host_result2.pop('invocation', None)
changed = 'changed' in host_result2 or host_result['changed']
ok_or_changed = 'ok'
if changed:
ok_or_changed = 'changed'
# show verbose output for non-setup module results if --verbose is used # show verbose output for non-setup module results if --verbose is used
msg = '' msg = ''
@ -318,17 +322,17 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
msg = "ok: [%s] => (item=%s)" % (host, item) msg = "ok: [%s] => (item=%s)" % (host, item)
else: else:
if 'ansible_job_id' not in host_result or 'finished' in host_result: if 'ansible_job_id' not in host_result or 'finished' in host_result:
msg = "ok: [%s]" % (host) msg = "%s: [%s]" % (ok_or_changed, host)
else: else:
# verbose ... # verbose ...
if item: if item:
msg = "ok: [%s] => (item=%s) => %s" % (host, item, utils.jsonify(host_result2)) msg = "%s: [%s] => (item=%s) => %s" % (ok_or_changed, host, item, utils.jsonify(host_result2))
else: else:
if 'ansible_job_id' not in host_result or 'finished' in host_result2: if 'ansible_job_id' not in host_result or 'finished' in host_result2:
msg = "ok: [%s] => %s" % (host, utils.jsonify(host_result2)) msg = "%s: [%s] => %s" % (host, utils.jsonify(host_result2))
if msg != '': if msg != '':
if not 'changed' in host_result2 or not host_result['changed']: if not changed:
print stringc(msg, 'green') print stringc(msg, 'green')
else: else:
print stringc(msg, 'yellow') print stringc(msg, 'yellow')

Loading…
Cancel
Save