From e969010cf9829c3f422e407a458fd9a70b249670 Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Mon, 5 Sep 2016 22:06:18 +0200 Subject: [PATCH] Add diff mode output to debconf module (#2530) Support diff such that the previous and current settings are visible without debug output and just with `--diff` if requested. --- lib/ansible/modules/extras/system/debconf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/system/debconf.py b/lib/ansible/modules/extras/system/debconf.py index 74818e908f4..4aa512b4a83 100644 --- a/lib/ansible/modules/extras/system/debconf.py +++ b/lib/ansible/modules/extras/system/debconf.py @@ -161,8 +161,14 @@ def main(): prev = {question: prev[question]} else: prev[question] = '' + if module._diff: + after = prev.copy() + after.update(curr) + diffdict = {'before': prev, 'after': after} + else: + diff_dict = {} - module.exit_json(changed=changed, msg=msg, current=curr, previous=prev) + module.exit_json(changed=changed, msg=msg, current=curr, previous=prev, diff=diff_dict) module.exit_json(changed=changed, msg=msg, current=prev)