ansible/ansible — pull request #8764 by EvanK (2014-08-26 21:21:37+00:00)
Title: Added restore module, for restoring previous ansible-made backups of a given file

The use case I built this for was an apache config file that was changed in a previous ansible run, where I needed it to be rolled back to its distro-provided "pristine" version before mangling it for the current run:

```
$ ls -1 /etc/apache2/mods-available/mpm_prefork.conf*
/etc/apache2/mods-available/mpm_prefork.conf
/etc/apache2/mods-available/mpm_prefork.conf.2014-08-25@20:11~
/etc/apache2/mods-available/mpm_prefork.conf.2014-08-26@09:42~
/etc/apache2/mods-available/mpm_prefork.conf.2014-08-26@14:02~
```

In the above example listing, said file was backed up & changed several times. The task below allows us to specifically restore the *oldest* timestamped backup (effectively overwriting the target file with `2014-08-25@20:11~`):

```
- restore: >
path=/etc/apache2/mods-available/mpm_prefork.conf
backup=no
which=oldest
```