# Saving file before it is changed

**URL:** <https://forum.ansible.com/t/saving-file-before-it-is-changed/15693>\
**Category:** Ansible Project\
**Created:** [July 17, 2014, 2:06pm UTC](https://forum.ansible.com/t/saving-file-before-it-is-changed/15693 "2014-07-17T14:06:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mauricio\_Tavares](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Mauricio\_Tavares](https://forum.ansible.com/u/Mauricio_Tavares)\
**Post date:** [July 17, 2014, 2:06pm UTC](https://forum.ansible.com/t/saving-file-before-it-is-changed/15693/1 "2014-07-17T14:06:45Z")

</div>

Let's say I have a template that will reapply my, say,  
/etc/ssh/sshd\_conf if it has changed. How can I save the old one just  
in case? Something like in /etc/ssh/Old would do fine; you get the  
idea.

---

<div class="post-metadata">

**Author:** ![RSchulze](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/rschulze/32/9329_2.png) [@RSchulze](https://forum.ansible.com/u/RSchulze)\
**Post date:** [July 17, 2014, 2:27pm UTC](https://forum.ansible.com/t/saving-file-before-it-is-changed/15693/2 "2014-07-17T14:27:05Z")

</div>

Something like the "backup" option in the template module?  
[http://docs.ansible.com/template\_module.html](http://docs.ansible.com/template_module.html)

---

<div class="post-metadata">

**Author:** ![Mauricio\_Tavares](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Mauricio\_Tavares](https://forum.ansible.com/u/Mauricio_Tavares)\
**Post date:** [July 17, 2014, 2:51pm UTC](https://forum.ansible.com/t/saving-file-before-it-is-changed/15693/3 "2014-07-17T14:51:10Z")

</div>

> Something like the "backup" option in the template module?  
> [http://docs.ansible.com/template\_module.html](http://docs.ansible.com/template_module.html)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I have a feeling that might be exactly what I need. 😉  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks!

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 17, 2014, 5:46pm UTC](https://forum.ansible.com/t/saving-file-before-it-is-changed/15693/4 "2014-07-17T17:46:14Z")

</div>

the backup feature should be really changed to do remote backups. This may come later.
