# Reporting previous/next state

**URL:** <https://forum.ansible.com/t/reporting-previous-next-state/17488>\
**Category:** Ansible Developer\
**Created:** [February 10, 2015, 12:56pm UTC](https://forum.ansible.com/t/reporting-previous-next-state/17488 "2015-02-10T12:56:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giovanni\_Tirloni](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Giovanni\_Tirloni](https://forum.ansible.com/u/Giovanni_Tirloni)\
**Post date:** [February 10, 2015, 12:56pm UTC](https://forum.ansible.com/t/reporting-previous-next-state/17488/1 "2015-02-10T12:56:45Z")

</div>

Hi,

I've been asked to determine what is the current state of some setting  
and what it's going to be changed to. The reasoning is that, this being  
a legacy environment full of manual controls, people want to see with  
their own eyes what Ansible is going to do before giving the OK. These  
enterprise folks know how to be boring, I know.

As a test, I changed the sysctl.py module to call exit\_json with some  
additional parameters (namely, value\_from and value\_to). So the output  
in verbose mode was something like this:

TASK: [sap\_common | sysctl net.ipv4.ip\_local\_port\_range]

---

<div class="post-metadata">

**Author:** ![Giovanni\_Tirloni](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Giovanni\_Tirloni](https://forum.ansible.com/u/Giovanni_Tirloni)\
**Post date:** [February 10, 2015, 7:08pm UTC](https://forum.ansible.com/t/reporting-previous-next-state/17488/2 "2015-02-10T19:08:09Z")

</div>

Yes, that works fine for template/copy, but it seems very specific for  
file changes.

It seems returning something in a simple matter of passing it to  
exit\_json/fail\_json. However, I wonder if a convention should be  
followed to avoid one module calling it value\_from, orig\_value,  
prev\_value, prev\_data, etc.

At the same time I'm thinking how likely it's that other people would  
find this valuable. I myself have not had the need until management  
asked for it and can't feel much sympathy for what we'll be done with  
this output in this case. But if more people find it usable I could work  
on something, although it looks like a long-term process of improving  
module by module.

Giovanni
