Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for recording diffs #29

Open
dmsimard opened this issue Apr 24, 2019 · 1 comment
Open

Add support for recording diffs #29

dmsimard opened this issue Apr 24, 2019 · 1 comment

Comments

@dmsimard
Copy link
Contributor

@dmsimard dmsimard commented Apr 24, 2019

Diffs are available from the callback but they are currently discarded:

https://github.com/ansible/ansible/blob/7b7d6a1fef42eed7e144a7c391817a0a8263c3ae/lib/ansible/plugins/callback/__init__.py#L113-L115

We can retrieve the diff before it is discarded around here:

The diff printed by Ansible looks like this:

TASK [template] **********************************************************************************************************************
--- before: /tmp/foo
+++ after: /home/fedora/.ansible/tmp/ansible-local-25447850rn27v/tmpu1ngsu7a/foo.j2
@@ -1 +1 @@
-this is a roary
+this is a roar

And this is the format in which the data is available from the callback:

[{'before_header': '/tmp/foo', 'before': 'this is a roary\n', 'after_header': '/home/fedora/.ansible/tmp/ansible-local-25447850rn27v/tmpu1ngsu7a/foo.j2', 'after': 'this is a roar\n'}]

It seems like this would be an addition to the result model. A diff column which would default to null. From a web client perspective, the diff could be displayed if there is one.

@FlorianLaunay

This comment has been minimized.

Copy link

@FlorianLaunay FlorianLaunay commented Sep 2, 2019

Any news on this maybe awesome feature ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.